Player now shoots two Shoots.
Halved Player DMG Bugfix: Beam and Rocket oneshooting Enemys Bugfix: Stuck Keys in Shop Bugfix: Items eating Shoots
This commit is contained in:
parent
e8400f4f34
commit
2ccc3ab483
|
@ -121,6 +121,7 @@ public class Keyboard implements KeyListener {
|
|||
if(e.getKeyCode() == KeyEvent.VK_0) {
|
||||
new EnemyBoss(400,400);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ public class RocketExplosionRange extends Shot{
|
|||
*/
|
||||
public void update() {
|
||||
i++;
|
||||
if(i>10){
|
||||
if(i>1){
|
||||
this.remove();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue