|
|
@ -9,6 +9,10 @@ import sig.objects.actor.RenderedObject; |
|
|
|
|
|
|
|
|
|
|
|
public class Erinoah extends PhysicsObject implements RenderedObject{ |
|
|
|
public class Erinoah extends PhysicsObject implements RenderedObject{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double lastMoved = 0; |
|
|
|
|
|
|
|
boolean moveDir = false; |
|
|
|
|
|
|
|
double moveTimer = 0; |
|
|
|
|
|
|
|
|
|
|
|
public Erinoah(double x, double y) { |
|
|
|
public Erinoah(double x, double y) { |
|
|
|
super(Sprite.ERINOAH,6.5,RabiClone.p); |
|
|
|
super(Sprite.ERINOAH,6.5,RabiClone.p); |
|
|
|
setX(x); |
|
|
|
setX(x); |
|
|
@ -32,6 +36,23 @@ public class Erinoah extends PhysicsObject implements RenderedObject{ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void update(double updateMult) { |
|
|
|
public void update(double updateMult) { |
|
|
|
super.update(updateMult); |
|
|
|
super.update(updateMult); |
|
|
|
|
|
|
|
lastMoved+=updateMult; |
|
|
|
|
|
|
|
if (lastMoved>5) { |
|
|
|
|
|
|
|
switch ((int)(Math.random()*3)) { |
|
|
|
|
|
|
|
case 0:{ |
|
|
|
|
|
|
|
moveDir=true; |
|
|
|
|
|
|
|
moveTimer=Math.random()*3; |
|
|
|
|
|
|
|
}break; |
|
|
|
|
|
|
|
case 1:{ |
|
|
|
|
|
|
|
moveDir=false; |
|
|
|
|
|
|
|
moveTimer=Math.random()*3; |
|
|
|
|
|
|
|
}break; |
|
|
|
|
|
|
|
case 2:{ |
|
|
|
|
|
|
|
lastMoved=0; |
|
|
|
|
|
|
|
}break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
moveTimer-=updateMult; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -45,11 +66,11 @@ public class Erinoah extends PhysicsObject implements RenderedObject{ |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean rightKeyHeld() { |
|
|
|
public boolean rightKeyHeld() { |
|
|
|
return false; |
|
|
|
return moveTimer>0&&moveDir; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean leftKeyHeld() { |
|
|
|
public boolean leftKeyHeld() { |
|
|
|
return false; |
|
|
|
return moveTimer>0&&!moveDir; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|