Fix this
This commit is contained in:
parent
921b30ca95
commit
6d2057f0c2
5 changed files with 60 additions and 13 deletions
|
|
@ -2,28 +2,54 @@ package ei.game.scene.weapons;
|
|||
|
||||
import ei.engine.effects.Particles;
|
||||
import ei.engine.math.Vector2f;
|
||||
import ei.engine.math.Vector2i;
|
||||
import ei.game.gamestate.InGameState;
|
||||
import ei.game.scene.Map;
|
||||
|
||||
public class BomberWeapon extends Weapon{
|
||||
private Particles part;
|
||||
private boolean hit;
|
||||
private Vector2i position;
|
||||
|
||||
public BomberWeapon(Vector2f startPos) {
|
||||
super(startPos);
|
||||
setVelocity(4);
|
||||
setRange(100);
|
||||
setDamage(10);
|
||||
hit = false;
|
||||
position = Map.getPosByPixel(startPos.getX(), startPos.getY());
|
||||
}
|
||||
public Particles getWeapon() {
|
||||
Particles part = new Particles("bomber");
|
||||
part = new Particles("bomber");
|
||||
part = new Particles("weapon");
|
||||
part.MaxSpeedX=500;
|
||||
part.MaxSpeedY=400;
|
||||
part.MaxSpeedZ=600;
|
||||
part.MaxSpeedX=700;
|
||||
part.MaxSpeedY=700;
|
||||
part.MaxSpeedZ=0;
|
||||
part.slowdown = 1;
|
||||
part.rainbow = false;
|
||||
part.size=10;
|
||||
part.regenerate = false;
|
||||
part.size=20;
|
||||
return part;
|
||||
}
|
||||
|
||||
public void update() {
|
||||
|
||||
if(!hit) {
|
||||
for(int i=position.getX()-1; i<=position.getX()+1; i++ ) {
|
||||
for(int j=position.getY()-1; i<=position.getY()+1; j++) {
|
||||
System.out.println("i :"+i+" j: "+j);
|
||||
if(InGameState.getMap().posExist(i, j)&& !InGameState.getMap().isPosEmpty(i, j)) {
|
||||
System.out.println("Damaged");
|
||||
InGameState.getMap().getPos(i, j).damaged(getDamage());
|
||||
}
|
||||
}
|
||||
}
|
||||
hit = true;
|
||||
}
|
||||
if(part.isDead()) {
|
||||
WeaponHandler.getInstance().removeWeapon(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue