verschiedene schuesse

This commit is contained in:
lubiana 2014-11-04 14:05:53 +01:00
parent 8a77a346e4
commit 0093078da7
6 changed files with 44 additions and 8 deletions

View File

@ -1,5 +1,6 @@
package de.teamteamteam.spacescooter.entity;
import de.teamteamteam.spacescooter.screen.Screen;
import java.util.Random;
public abstract class Enemy extends ShootingEntity {
@ -21,5 +22,13 @@ public abstract class Enemy extends ShootingEntity {
this.shoot();
}
@Override
protected void shoot() {
if(this.currentShootDelay == 0) {
Screen.currentScreen.addEntity(new SingleRedShot(this.x + this.shootSpawnX, this.y + this.shootSpawnY, this.shootDirection, this.shootSpeed, this.damageValue));
this.currentShootDelay = this.shootDelay;
}
}
}

View File

@ -3,6 +3,7 @@ package de.teamteamteam.spacescooter.entity;
import java.awt.event.KeyEvent;
import de.teamteamteam.spacescooter.control.Keyboard;
import de.teamteamteam.spacescooter.utility.GameConfig;
import de.teamteamteam.spacescooter.screen.Screen;
public class Player extends ShootingEntity {
@ -48,6 +49,14 @@ public class Player extends ShootingEntity {
}
@Override
protected void shoot() {
if(this.currentShootDelay == 0) {
Screen.currentScreen.addEntity(new SingleBlueShot(this.x + this.shootSpawnX, this.y + this.shootSpawnY, this.shootDirection, this.shootSpeed, this.damageValue));
this.currentShootDelay = this.shootDelay;
}
}
public void setCanMove(boolean canMove){
this.canMove = canMove;
}

View File

@ -4,13 +4,13 @@ import de.teamteamteam.spacescooter.screen.Screen;
public abstract class ShootingEntity extends LivingEntity {
private int shootDelay;
private int currentShootDelay;
private int shootSpawnX;
private int shootSpawnY;
private int shootDirection;
private int damageValue = 5;
private int shootSpeed;
protected int shootDelay;
protected int currentShootDelay;
protected int shootSpawnX;
protected int shootSpawnY;
protected int shootDirection;
protected int damageValue = 5;
protected int shootSpeed;
public ShootingEntity(int x, int y) {
super(x, y);

View File

@ -0,0 +1,9 @@
package de.teamteamteam.spacescooter.entity;
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");
}
}

View File

@ -0,0 +1,9 @@
package de.teamteamteam.spacescooter.entity;
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");
}
}

View File

@ -4,6 +4,6 @@ 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/shot.png");
this.setImage("images/shot02.png");
}
}