63 lines
1.5 KiB
Java
63 lines
1.5 KiB
Java
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(30);
|
|
setReload(150);
|
|
hit = false;
|
|
position = Map.getPosByPixel(startPos.getX(), startPos.getY());
|
|
}
|
|
|
|
public Particles getWeapon() {
|
|
part = new Particles("bomber");
|
|
part = new Particles("weapon");
|
|
part.MaxSpeedX=700;
|
|
part.MaxSpeedY=700;
|
|
part.MaxSpeedZ=0;
|
|
part.slowdown = 1;
|
|
part.rainbow = false;
|
|
part.regenerate = false;
|
|
part.size=10;
|
|
float colors[][][]= // Rainbow Of Colors
|
|
{
|
|
{{0.0f,0.5f,1.0f},{0.0f,0.5f,1.0f}}
|
|
|
|
};
|
|
part.colors = colors;
|
|
return part;
|
|
}
|
|
|
|
public void update() {
|
|
|
|
if(!hit) {
|
|
for(int i=position.getX()-1; i<=position.getX()+1; i++ ) {
|
|
for(int j=position.getY(); j<=position.getY()+2; 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);
|
|
}
|
|
|
|
}
|
|
|
|
}
|