From 0093078da7866a82a54354a9c7c08636b120b4fc Mon Sep 17 00:00:00 2001 From: lubiana Date: Tue, 4 Nov 2014 14:05:53 +0100 Subject: [PATCH] verschiedene schuesse --- src/de/teamteamteam/spacescooter/entity/Enemy.java | 9 +++++++++ .../teamteamteam/spacescooter/entity/Player.java | 9 +++++++++ .../spacescooter/entity/ShootingEntity.java | 14 +++++++------- .../spacescooter/entity/SingleBlueShot.java | 9 +++++++++ .../spacescooter/entity/SingleRedShot.java | 9 +++++++++ .../spacescooter/entity/SingleShot.java | 2 +- 6 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 src/de/teamteamteam/spacescooter/entity/SingleBlueShot.java create mode 100644 src/de/teamteamteam/spacescooter/entity/SingleRedShot.java diff --git a/src/de/teamteamteam/spacescooter/entity/Enemy.java b/src/de/teamteamteam/spacescooter/entity/Enemy.java index 6c888f6..90e8a1a 100644 --- a/src/de/teamteamteam/spacescooter/entity/Enemy.java +++ b/src/de/teamteamteam/spacescooter/entity/Enemy.java @@ -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; + } + } + } diff --git a/src/de/teamteamteam/spacescooter/entity/Player.java b/src/de/teamteamteam/spacescooter/entity/Player.java index b6e2004..c402317 100644 --- a/src/de/teamteamteam/spacescooter/entity/Player.java +++ b/src/de/teamteamteam/spacescooter/entity/Player.java @@ -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; } diff --git a/src/de/teamteamteam/spacescooter/entity/ShootingEntity.java b/src/de/teamteamteam/spacescooter/entity/ShootingEntity.java index 0835c94..dbff426 100644 --- a/src/de/teamteamteam/spacescooter/entity/ShootingEntity.java +++ b/src/de/teamteamteam/spacescooter/entity/ShootingEntity.java @@ -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); diff --git a/src/de/teamteamteam/spacescooter/entity/SingleBlueShot.java b/src/de/teamteamteam/spacescooter/entity/SingleBlueShot.java new file mode 100644 index 0000000..784b931 --- /dev/null +++ b/src/de/teamteamteam/spacescooter/entity/SingleBlueShot.java @@ -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"); + } +} diff --git a/src/de/teamteamteam/spacescooter/entity/SingleRedShot.java b/src/de/teamteamteam/spacescooter/entity/SingleRedShot.java new file mode 100644 index 0000000..9da1829 --- /dev/null +++ b/src/de/teamteamteam/spacescooter/entity/SingleRedShot.java @@ -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"); + } +} diff --git a/src/de/teamteamteam/spacescooter/entity/SingleShot.java b/src/de/teamteamteam/spacescooter/entity/SingleShot.java index 3850ba8..d803f32 100644 --- a/src/de/teamteamteam/spacescooter/entity/SingleShot.java +++ b/src/de/teamteamteam/spacescooter/entity/SingleShot.java @@ -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"); } }