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{
|
public class Erinoah extends PhysicsObject implements RenderedObject{
|
||||||
|
|
||||||
double lastMoved = 0;
|
double lastMoved = 0;
|
||||||
|
double lastJumped = 0;
|
||||||
boolean moveDir = false;
|
boolean moveDir = false;
|
||||||
double moveTimer = 0;
|
double moveTimer = 0;
|
||||||
|
|
||||||
@ -37,6 +38,7 @@ public class Erinoah extends PhysicsObject implements RenderedObject{
|
|||||||
public void update(double updateMult) {
|
public void update(double updateMult) {
|
||||||
super.update(updateMult);
|
super.update(updateMult);
|
||||||
lastMoved+=updateMult;
|
lastMoved+=updateMult;
|
||||||
|
lastJumped+=updateMult;
|
||||||
if (lastMoved>5) {
|
if (lastMoved>5) {
|
||||||
switch ((int)(Math.random()*3)) {
|
switch ((int)(Math.random()*3)) {
|
||||||
case 0:{
|
case 0:{
|
||||||
@ -47,9 +49,17 @@ public class Erinoah extends PhysicsObject implements RenderedObject{
|
|||||||
moveDir=false;
|
moveDir=false;
|
||||||
moveTimer=Math.random()*3;
|
moveTimer=Math.random()*3;
|
||||||
}break;
|
}break;
|
||||||
case 2:{
|
}
|
||||||
lastMoved=0;
|
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;
|
moveTimer-=updateMult;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package sig.objects.actor;
|
package sig.objects.actor;
|
||||||
|
|
||||||
public enum State{
|
public enum State{
|
||||||
IDLE,
|
IDLE,
|
||||||
SLIDE,
|
SLIDE,
|
||||||
JUMP,
|
JUMP,
|
||||||
FALLING,
|
FALLING,
|
||||||
ATTACK,
|
ATTACK,
|
||||||
STAGGER,
|
STAGGER,
|
||||||
UNCONTROLLABLE
|
UNCONTROLLABLE
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user