Bunnies randomly hop.
Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com> Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
31bb16e54e
commit
79e6f9504b
@ -10,6 +10,7 @@ import sig.objects.actor.RenderedObject;
|
||||
public class Erinoah extends PhysicsObject implements RenderedObject{
|
||||
|
||||
double lastMoved = 0;
|
||||
double lastJumped = 0;
|
||||
boolean moveDir = false;
|
||||
double moveTimer = 0;
|
||||
|
||||
@ -37,6 +38,7 @@ public class Erinoah extends PhysicsObject implements RenderedObject{
|
||||
public void update(double updateMult) {
|
||||
super.update(updateMult);
|
||||
lastMoved+=updateMult;
|
||||
lastJumped+=updateMult;
|
||||
if (lastMoved>5) {
|
||||
switch ((int)(Math.random()*3)) {
|
||||
case 0:{
|
||||
@ -47,9 +49,17 @@ public class Erinoah extends PhysicsObject implements RenderedObject{
|
||||
moveDir=false;
|
||||
moveTimer=Math.random()*3;
|
||||
}break;
|
||||
case 2:{
|
||||
}
|
||||
lastMoved=0;
|
||||
}break;
|
||||
}
|
||||
if (lastJumped>3) {
|
||||
if (Math.random()<=0.4&&jumpCount>0) {
|
||||
y_velocity = jump_velocity;
|
||||
jumpCount--;
|
||||
lastJumped=2.5+Math.random()*0.5;
|
||||
lastMoved=4.5+Math.random()*0.5;
|
||||
} else {
|
||||
lastJumped=0;
|
||||
}
|
||||
}
|
||||
moveTimer-=updateMult;
|
||||
|
@ -1,11 +1,11 @@
|
||||
package sig.objects.actor;
|
||||
|
||||
public enum State{
|
||||
IDLE,
|
||||
SLIDE,
|
||||
JUMP,
|
||||
FALLING,
|
||||
ATTACK,
|
||||
STAGGER,
|
||||
UNCONTROLLABLE
|
||||
IDLE,
|
||||
SLIDE,
|
||||
JUMP,
|
||||
FALLING,
|
||||
ATTACK,
|
||||
STAGGER,
|
||||
UNCONTROLLABLE
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user