diff --git a/src/de/teamteamteam/spacescooter/control/Keyboard.java b/src/de/teamteamteam/spacescooter/control/Keyboard.java index a6d3420..8fe5d1f 100644 --- a/src/de/teamteamteam/spacescooter/control/Keyboard.java +++ b/src/de/teamteamteam/spacescooter/control/Keyboard.java @@ -121,6 +121,7 @@ public class Keyboard implements KeyListener { if(e.getKeyCode() == KeyEvent.VK_0) { new EnemyBoss(400,400); } + } /** diff --git a/src/de/teamteamteam/spacescooter/entity/Player.java b/src/de/teamteamteam/spacescooter/entity/Player.java index 0e5c46a..e024d47 100644 --- a/src/de/teamteamteam/spacescooter/entity/Player.java +++ b/src/de/teamteamteam/spacescooter/entity/Player.java @@ -70,7 +70,7 @@ public class Player extends ShootingEntity implements KeyboardListener { this.setMaximumHealthPoints(PlayerSession.getShipHealthPoints()); this.setShieldPoints(PlayerSession.getShipShieldPoints()); this.setMaximumShieldPoints(PlayerSession.getShipShieldPoints()); - this.setShootDamage(PlayerSession.getShipShotDamage()); + this.setShootDamage((PlayerSession.getShipShotDamage())/2); this.registerOnKeyboard(Keyboard.getInstance()); } @@ -158,8 +158,8 @@ public class Player extends ShootingEntity implements KeyboardListener { * createShot method that trigger the ShootingEntity.createShot() method and play a nice sound */ @Override - public void createShot() { - super.createShot(); + public void createShot(int x, int y) { + super.createShot(x,y); SoundSystem.playSound("sounds/shot_fired1.wav"); } @@ -206,6 +206,17 @@ public class Player extends ShootingEntity implements KeyboardListener { * empty keyTyped method, maybe useful for cheatcodes later */ public void keyTyped(KeyEvent e) {} + + @Override + public void shoot() { + if(this.canShoot() == true) { + if(this.getCurrentShootDelay() == 0) { + this.createShot(30,8); + this.createShot(30,23); + setCurrentShootDelay(this.getShootDelay()); + } + } + } @Override diff --git a/src/de/teamteamteam/spacescooter/entity/ShootingEntity.java b/src/de/teamteamteam/spacescooter/entity/ShootingEntity.java index c8d344f..e28dcf9 100644 --- a/src/de/teamteamteam/spacescooter/entity/ShootingEntity.java +++ b/src/de/teamteamteam/spacescooter/entity/ShootingEntity.java @@ -174,6 +174,27 @@ public abstract class ShootingEntity extends LivingEntity { this.shootSpawnY = y; } + /** + * Get the shoot delay. + */ + public int getShootDelay() { + return this.shootDelay; + } + + /** + * Get the current shoot delay. + */ + public int getCurrentShootDelay() { + return this.currentShootDelay; + } + + /** + * Set the current shoot delay. + */ + public void setCurrentShootDelay(int delay) { + this.currentShootDelay = delay; + } + /** * Set the damage value the fired shots will cause. */ @@ -210,6 +231,17 @@ public abstract class ShootingEntity extends LivingEntity { ); } + public void createShot(int x_offset, int y_offset) { + new Shot( + this.getX() + x_offset, + this.getY() + y_offset, + this.shootDirection, + this.shootSpeed, + this.shootDamage, + this.primaryShotImage + ); + } + /** * Internal method to actually spawn a fired rocket. */ diff --git a/src/de/teamteamteam/spacescooter/entity/shot/Beam.java b/src/de/teamteamteam/spacescooter/entity/shot/Beam.java index d52116d..febc5b5 100644 --- a/src/de/teamteamteam/spacescooter/entity/shot/Beam.java +++ b/src/de/teamteamteam/spacescooter/entity/shot/Beam.java @@ -15,7 +15,7 @@ public class Beam extends Shot { @Override public void update() { this.i++; - if(this.i>10){ + if(this.i>1){ this.remove(); } } diff --git a/src/de/teamteamteam/spacescooter/entity/shot/Rocket.java b/src/de/teamteamteam/spacescooter/entity/shot/Rocket.java index 5760489..6b77021 100644 --- a/src/de/teamteamteam/spacescooter/entity/shot/Rocket.java +++ b/src/de/teamteamteam/spacescooter/entity/shot/Rocket.java @@ -15,6 +15,7 @@ public class Rocket extends Shot { @Override public void collideWith(Collidable entity) { new RocketExplosionRange(this.getX(), this.getY(), this.getDirection(), this.getSpeed(), this.getDamageValue(), "images/shots/rocket_explosion.png"); + this.setDamageValue(0); super.collideWith(entity); } } diff --git a/src/de/teamteamteam/spacescooter/entity/shot/RocketExplosionRange.java b/src/de/teamteamteam/spacescooter/entity/shot/RocketExplosionRange.java index 4fd5a52..a491486 100644 --- a/src/de/teamteamteam/spacescooter/entity/shot/RocketExplosionRange.java +++ b/src/de/teamteamteam/spacescooter/entity/shot/RocketExplosionRange.java @@ -15,7 +15,7 @@ public class RocketExplosionRange extends Shot{ */ public void update() { i++; - if(i>10){ + if(i>1){ this.remove(); } } diff --git a/src/de/teamteamteam/spacescooter/screen/ShopScreen.java b/src/de/teamteamteam/spacescooter/screen/ShopScreen.java index 48e7c9a..fa9eeb3 100644 --- a/src/de/teamteamteam/spacescooter/screen/ShopScreen.java +++ b/src/de/teamteamteam/spacescooter/screen/ShopScreen.java @@ -70,7 +70,7 @@ public class ShopScreen extends Screen { this.player.setPosition(50, this.player.getY()); this.player.setPosition(this.player.getX(), 159+(this.menuPoint*100)); } - }else if ( (Keyboard.isKeyDown(KeyEvent.VK_ENTER) || Keyboard.isKeyDown(KeyEvent.VK_SPACE)) && !this.keyPressed && this.animationStatus == 0) { + }else if ( (Keyboard.isKeyDown(KeyEvent.VK_SPACE) || Keyboard.isKeyDown(KeyEvent.VK_ENTER)) && !this.keyPressed && this.animationStatus == 0) { this.keyPressed = true; /////////////////////////////////////////////////////////////// switch (this.menuPoint) { @@ -103,7 +103,7 @@ public class ShopScreen extends Screen { break; } } - if(!Keyboard.isKeyDown(KeyEvent.VK_DOWN) && !Keyboard.isKeyDown(KeyEvent.VK_UP) && !Keyboard.isKeyDown(KeyEvent.VK_ENTER)) { + if(!Keyboard.isKeyDown(KeyEvent.VK_DOWN) && !Keyboard.isKeyDown(KeyEvent.VK_UP) && !Keyboard.isKeyDown(KeyEvent.VK_ENTER) && !Keyboard.isKeyDown(KeyEvent.VK_SPACE)) { this.keyPressed = false; } diff --git a/src/de/teamteamteam/spacescooter/utility/CollisionHandler.java b/src/de/teamteamteam/spacescooter/utility/CollisionHandler.java index eaa34be..a1d7b48 100644 --- a/src/de/teamteamteam/spacescooter/utility/CollisionHandler.java +++ b/src/de/teamteamteam/spacescooter/utility/CollisionHandler.java @@ -4,6 +4,7 @@ import de.teamteamteam.spacescooter.datastructure.ConcurrentIterator; import de.teamteamteam.spacescooter.entity.Entity; import de.teamteamteam.spacescooter.entity.Player; import de.teamteamteam.spacescooter.entity.enemy.Enemy; +import de.teamteamteam.spacescooter.entity.item.Item; import de.teamteamteam.spacescooter.entity.shot.Shot; import de.teamteamteam.spacescooter.entity.spi.Collidable; import de.teamteamteam.spacescooter.screen.Screen; @@ -41,6 +42,8 @@ public class CollisionHandler { if(entityOne instanceof Enemy && entityTwo instanceof Enemy) continue; if(entityOne instanceof Player && entityTwo instanceof Player) continue; if(entityOne instanceof Shot && entityTwo instanceof Shot) continue; + if(entityOne instanceof Item && entityTwo instanceof Shot) continue; + if(entityOne instanceof Shot && entityTwo instanceof Item) continue; Collidable collidableTwo = (Collidable) entityTwo; if(!collidableTwo.canCollide()) continue; //skip checks against itself