Add fire shots for Player and Enemy.
This commit is contained in:
parent
1c10c8bce0
commit
981b2c7513
BIN
res/sounds/shot_fired1.wav
Normal file
BIN
res/sounds/shot_fired1.wav
Normal file
Binary file not shown.
BIN
res/sounds/shot_fired2.wav
Normal file
BIN
res/sounds/shot_fired2.wav
Normal file
Binary file not shown.
@ -75,6 +75,12 @@ public class Player extends ShootingEntity implements KeyboardListener {
|
|||||||
SoundSystem.playSound("sounds/abgang.wav");
|
SoundSystem.playSound("sounds/abgang.wav");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createShot() {
|
||||||
|
super.createShot();
|
||||||
|
SoundSystem.playSound("sounds/shot_fired1.wav");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On cleanup, unregister from the keyboard.
|
* On cleanup, unregister from the keyboard.
|
||||||
*/
|
*/
|
||||||
|
@ -166,7 +166,7 @@ public abstract class ShootingEntity extends LivingEntity {
|
|||||||
/**
|
/**
|
||||||
* Internal method to actually spawn the fired Shots.
|
* Internal method to actually spawn the fired Shots.
|
||||||
*/
|
*/
|
||||||
private void createShot() {
|
public void createShot() {
|
||||||
new Shot(
|
new Shot(
|
||||||
this.getX() + this.shootSpawnX,
|
this.getX() + this.shootSpawnX,
|
||||||
this.getY() + this.shootSpawnY,
|
this.getY() + this.shootSpawnY,
|
||||||
|
@ -2,6 +2,7 @@ package de.teamteamteam.spacescooter.entity.enemy;
|
|||||||
|
|
||||||
import de.teamteamteam.spacescooter.entity.ShootingEntity;
|
import de.teamteamteam.spacescooter.entity.ShootingEntity;
|
||||||
import de.teamteamteam.spacescooter.entity.shot.Shot;
|
import de.teamteamteam.spacescooter.entity.shot.Shot;
|
||||||
|
import de.teamteamteam.spacescooter.sound.SoundSystem;
|
||||||
import de.teamteamteam.spacescooter.utility.Random;
|
import de.teamteamteam.spacescooter.utility.Random;
|
||||||
|
|
||||||
public abstract class Enemy extends ShootingEntity {
|
public abstract class Enemy extends ShootingEntity {
|
||||||
@ -22,6 +23,12 @@ public abstract class Enemy extends ShootingEntity {
|
|||||||
if(willShoot == true)
|
if(willShoot == true)
|
||||||
this.shoot();
|
this.shoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createShot() {
|
||||||
|
super.createShot();
|
||||||
|
SoundSystem.playSound("sounds/shot_fired2.wav");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user