Add HPB to the beam weapon :3
This commit is contained in:
parent
fc762b3caf
commit
ce668182ed
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
|
@ -0,0 +1,43 @@
|
||||||
|
package de.teamteamteam.spacescooter.entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Image that will position itself centered on the given position and lives for a
|
||||||
|
* short period of time.
|
||||||
|
*/
|
||||||
|
public class FlashImage extends Entity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal lifetime counter.
|
||||||
|
*/
|
||||||
|
private int lifetime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal tick counter.
|
||||||
|
*/
|
||||||
|
private int tickCounter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor.
|
||||||
|
*/
|
||||||
|
public FlashImage(int x, int y, String imagefilename, int lifetime) {
|
||||||
|
super(x, y);
|
||||||
|
this.setImage(imagefilename);
|
||||||
|
this.setPosition(x - (this.getImageWidth()/2), y - (this.getImageHeight()/2));
|
||||||
|
this.lifetime = lifetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Just wait for the time to run out and remove itself after that.
|
||||||
|
*/
|
||||||
|
public void update() {
|
||||||
|
this.tickCounter++;
|
||||||
|
if(tickCounter == 10) {
|
||||||
|
this.lifetime--;
|
||||||
|
if(this.lifetime == 0) {
|
||||||
|
this.remove();
|
||||||
|
}
|
||||||
|
this.tickCounter = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -225,6 +225,7 @@ public class Player extends ShootingEntity implements KeyboardListener {
|
||||||
@Override
|
@Override
|
||||||
public void createBeam() {
|
public void createBeam() {
|
||||||
super.createBeam();
|
super.createBeam();
|
||||||
|
new FlashImage(this.getX(), this.getY(), "images/hpb_shout.png", 3);
|
||||||
this.removeSecondaryWeaponAmount();
|
this.removeSecondaryWeaponAmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue