Bugfixes
This commit is contained in:
@@ -30,6 +30,30 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
||||
collisions.moveCheck(this, cx, cy, !type.allowLegStep ? EntityCollisions::solid : EntityCollisions::legsSolid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(){
|
||||
resetLegs();
|
||||
}
|
||||
|
||||
public void resetLegs(){
|
||||
float rot = baseRotation;
|
||||
int count = type.legCount;
|
||||
float legLength = type.legLength;
|
||||
|
||||
this.legs = new Leg[count];
|
||||
|
||||
float spacing = 360f / count;
|
||||
|
||||
for(int i = 0; i < legs.length; i++){
|
||||
Leg l = new Leg();
|
||||
|
||||
l.joint.trns(i * spacing + rot, legLength/2f + type.legBaseOffset).add(x, y);
|
||||
l.base.trns(i * spacing + rot, legLength + type.legBaseOffset).add(x, y);
|
||||
|
||||
legs[i] = l;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
if(Mathf.dst(deltaX(), deltaY()) > 0.001f){
|
||||
@@ -37,23 +61,11 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
||||
}
|
||||
|
||||
float rot = baseRotation;
|
||||
int count = type.legCount;
|
||||
float legLength = type.legLength;
|
||||
|
||||
//set up initial leg positions
|
||||
if(legs.length != type.legCount){
|
||||
this.legs = new Leg[count];
|
||||
|
||||
float spacing = 360f / count;
|
||||
|
||||
for(int i = 0; i < legs.length; i++){
|
||||
Leg l = new Leg();
|
||||
|
||||
l.joint.trns(i * spacing + rot, legLength/2f + type.legBaseOffset).add(x, y);
|
||||
l.base.trns(i * spacing + rot, legLength + type.legBaseOffset).add(x, y);
|
||||
|
||||
legs[i] = l;
|
||||
}
|
||||
resetLegs();
|
||||
}
|
||||
|
||||
float moveSpeed = type.legSpeed;
|
||||
|
||||
Reference in New Issue
Block a user