From 2ff144eb35ee128a5834142c28f8c86badf378c9 Mon Sep 17 00:00:00 2001 From: Sosch Date: Tue, 25 Nov 2014 14:52:47 +0100 Subject: [PATCH] =?UTF-8?q?EnemyFour=20=C3=BCberarbeitet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../teamteamteam/spacescooter/entity/enemy/EnemyFour.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyFour.java b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyFour.java index ed93c2a..e8834ec 100644 --- a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyFour.java +++ b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyFour.java @@ -12,6 +12,7 @@ public class EnemyFour extends Enemy{ private double y; private double vektorX; private double vektorY; + private int speed = 2; public EnemyFour(int x, int y, ArrayList points) { super(x, y); @@ -35,11 +36,12 @@ public class EnemyFour extends Enemy{ public void update() { super.update(); - this.x -= vektorX; - this.y -= vektorY; + this.x -= vektorX*speed; + this.y -= vektorY*speed; 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(); } }