EnemyFour überarbeitet
This commit is contained in:
parent
52f038d4c4
commit
2ff144eb35
|
@ -12,6 +12,7 @@ public class EnemyFour extends Enemy{
|
||||||
private double y;
|
private double y;
|
||||||
private double vektorX;
|
private double vektorX;
|
||||||
private double vektorY;
|
private double vektorY;
|
||||||
|
private int speed = 2;
|
||||||
|
|
||||||
public EnemyFour(int x, int y, ArrayList<Point> points) {
|
public EnemyFour(int x, int y, ArrayList<Point> points) {
|
||||||
super(x, y);
|
super(x, y);
|
||||||
|
@ -35,11 +36,12 @@ public class EnemyFour extends Enemy{
|
||||||
public void update() {
|
public void update() {
|
||||||
super.update();
|
super.update();
|
||||||
|
|
||||||
this.x -= vektorX;
|
this.x -= vektorX*speed;
|
||||||
this.y -= vektorY;
|
this.y -= vektorY*speed;
|
||||||
this.setPosition((int)x, (int)y);
|
this.setPosition((int)x, (int)y);
|
||||||
|
|
||||||
if(this.getX() == (int)nextPoint.getX() && this.getY() == (int)nextPoint.getY()){
|
if(this.getX()+2 >= (int)nextPoint.getX() && this.getX()-2 <= (int)nextPoint.getX()
|
||||||
|
&& this.getY()+2 >= (int)nextPoint.getY() && this.getY()+1 <= (int)nextPoint.getY()){
|
||||||
getNextPoint();
|
getNextPoint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue