nullllpointrrrr
This commit is contained in:
parent
6f2857946d
commit
a16ef5d7a7
@ -1,6 +1,6 @@
|
||||
package de.teamteamteam.spacescooter.entity;
|
||||
|
||||
import de.teamteamteam.spacescooter.entity.shot.SingleBlueShot;
|
||||
import de.teamteamteam.spacescooter.entity.shot.Shot;
|
||||
|
||||
public abstract class ShootingEntity extends LivingEntity {
|
||||
|
||||
@ -13,6 +13,7 @@ public abstract class ShootingEntity extends LivingEntity {
|
||||
private int shootDirection;
|
||||
private int damageValue = 5;
|
||||
private int shootSpeed;
|
||||
private String primaryShotImage = "images/shot01.png";
|
||||
|
||||
public ShootingEntity(int x, int y) {
|
||||
super(x, y);
|
||||
@ -37,7 +38,14 @@ public abstract class ShootingEntity extends LivingEntity {
|
||||
* Override this method in the actual enemy class to change the type of shot the entity creates.
|
||||
*/
|
||||
public void createShot() {
|
||||
new SingleBlueShot(this.x + this.shootSpawnX, this.y + this.shootSpawnY, this.shootDirection, this.shootSpeed, this.damageValue);
|
||||
new Shot(
|
||||
this.x + this.shootSpawnX,
|
||||
this.y + this.shootSpawnY,
|
||||
this.shootDirection,
|
||||
this.shootSpeed,
|
||||
this.damageValue,
|
||||
this.primaryShotImage
|
||||
);
|
||||
}
|
||||
|
||||
public void setCanShoot(boolean canShoot) {
|
||||
@ -77,20 +85,9 @@ public abstract class ShootingEntity extends LivingEntity {
|
||||
return this.damageValue;
|
||||
}
|
||||
|
||||
protected int getShootSpawnX(){
|
||||
return this.shootSpawnX;
|
||||
public void setPrimaryShotImage(String filename){
|
||||
this.primaryShotImage = filename;
|
||||
}
|
||||
|
||||
protected int getShootSpawnY(){
|
||||
return this.shootSpawnY;
|
||||
}
|
||||
|
||||
protected int getShootDirection(){
|
||||
return this.shootDirection;
|
||||
}
|
||||
|
||||
protected int getShootSpeed(){
|
||||
return this.shootSpeed;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ import java.util.Random;
|
||||
|
||||
import de.teamteamteam.spacescooter.entity.ShootingEntity;
|
||||
import de.teamteamteam.spacescooter.entity.shot.Shot;
|
||||
import de.teamteamteam.spacescooter.entity.shot.SingleRedShot;
|
||||
|
||||
public abstract class Enemy extends ShootingEntity {
|
||||
|
||||
@ -13,6 +12,7 @@ public abstract class Enemy extends ShootingEntity {
|
||||
this.name = "EnemyOne";
|
||||
this.willShoot = r.nextBoolean();
|
||||
this.setShootDirection(Shot.LEFT);
|
||||
this.setPrimaryShotImage("images/shot03.png");
|
||||
}
|
||||
|
||||
protected String name;
|
||||
@ -24,16 +24,6 @@ public abstract class Enemy extends ShootingEntity {
|
||||
this.shoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createShot() {
|
||||
new SingleRedShot(
|
||||
super.getX() + super.getShootSpawnX(),
|
||||
super.getY() + super.getShootSpawnY(),
|
||||
super.getShootDirection(),
|
||||
super.getShootSpeed(),
|
||||
super.getDamageValue()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@ package de.teamteamteam.spacescooter.entity.shot;
|
||||
import de.teamteamteam.spacescooter.entity.LivingEntity;
|
||||
import de.teamteamteam.spacescooter.utility.GameConfig;
|
||||
|
||||
public abstract class Shot extends LivingEntity {
|
||||
public class Shot extends LivingEntity {
|
||||
|
||||
public static final int RIGHT = 1;
|
||||
public static final int LEFT= -1;
|
||||
@ -14,19 +14,21 @@ public abstract class Shot extends LivingEntity {
|
||||
private int speed;
|
||||
private int direction;
|
||||
|
||||
public Shot(int x, int y, int shootDirection, int shootSpeed, int damageValue) {
|
||||
public Shot(int x, int y, int shootDirection, int shootSpeed, int damageValue, String filename) {
|
||||
super(x, y);
|
||||
this.direction = shootDirection;
|
||||
this.speed = shootSpeed;
|
||||
this.collisionCount = 1;
|
||||
this.damageValue = damageValue;
|
||||
}
|
||||
|
||||
public void setImage(String filename) {
|
||||
super.setImage(filename);
|
||||
this.setPosition(this.x - this.getImage().getWidth() / 2, this.y - this.getImage().getHeight() / 2);
|
||||
}
|
||||
|
||||
//public void setImage(String filename) {
|
||||
//super.setImage(filename);
|
||||
//this.setPosition(this.x - this.getImage().getWidth() / 2, this.y - this.getImage().getHeight() / 2);
|
||||
//}
|
||||
|
||||
public int getDamageValue() {
|
||||
return this.damageValue;
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
package de.teamteamteam.spacescooter.entity.shot;
|
||||
|
||||
public class SingleBlueShot extends Shot {
|
||||
|
||||
public SingleBlueShot(int x, int y, int shootDirection, int shootSpeed, int damageValue) {
|
||||
super(x, y, shootDirection, shootSpeed, damageValue);
|
||||
this.setImage("images/shot02.png");
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package de.teamteamteam.spacescooter.entity.shot;
|
||||
|
||||
public class SingleRedShot extends Shot {
|
||||
|
||||
public SingleRedShot(int x, int y, int shootDirection, int shootSpeed, int damageValue) {
|
||||
super(x, y, shootDirection, shootSpeed, damageValue);
|
||||
this.setImage("images/shot04.png");
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package de.teamteamteam.spacescooter.entity.shot;
|
||||
|
||||
public class SingleShot extends Shot {
|
||||
|
||||
public SingleShot(int x, int y, int shootDirection, int shootSpeed, int damageValue) {
|
||||
super(x, y, shootDirection, shootSpeed, damageValue);
|
||||
this.setImage("images/shot02.png");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user