mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-02-21 20:18:14 +07:00
Fixed entity starting direction
Fixed entity starting direction Changed default angle for Player entities to -PI/2 Entities will no longer update angles to target if target is zero Re-enabled animation speeds for walk animations
This commit is contained in:
parent
18acef4791
commit
0e7c0f8fb9
@ -428,9 +428,9 @@ public class Entity {
|
||||
|
||||
// TODO: This seems to work well with the default movement speeds of most entities I've seen
|
||||
if (mode.equalsIgnoreCase("WL")) {
|
||||
//animation.setFrameDelta(128);
|
||||
animation.setFrameDelta(128);
|
||||
} else if (mode.equalsIgnoreCase("RN")) {
|
||||
//animation.setFrameDelta(128);
|
||||
animation.setFrameDelta(128);
|
||||
}
|
||||
|
||||
dirty = 0;
|
||||
@ -439,6 +439,7 @@ public class Entity {
|
||||
private boolean updateAnimation(COF cof) {
|
||||
if (animation == null) {
|
||||
animation = Animation.newAnimation(cof);
|
||||
animation.setDirection(getDirection());
|
||||
return true;
|
||||
} else {
|
||||
return animation.reset(cof);
|
||||
|
@ -3,6 +3,7 @@ package gdx.diablo.entity;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.GdxRuntimeException;
|
||||
|
||||
@ -71,6 +72,7 @@ public class Player extends Entity {
|
||||
public Player(D2S d2s) {
|
||||
super(Diablo.files.PlrType.get(d2s.charClass).Token, EntType.PLAYER);
|
||||
setMode("TN");
|
||||
setAngle(-MathUtils.PI / 2);
|
||||
setWalkSpeed(6);
|
||||
setRunSpeed(9);
|
||||
setRunning(true);
|
||||
@ -83,6 +85,7 @@ public class Player extends Entity {
|
||||
public Player(String name, int classId) {
|
||||
super(Diablo.files.PlrType.get(classId).Token, EntType.PLAYER);
|
||||
setMode("TN");
|
||||
setAngle(-MathUtils.PI / 2);
|
||||
setWalkSpeed(6);
|
||||
setRunSpeed(9);
|
||||
setRunning(true);
|
||||
|
@ -424,7 +424,7 @@ public class GameScreen extends ScreenAdapter implements LoadingScreen.Loadable
|
||||
|
||||
for (Entity entity : entities.values()) {
|
||||
entity.update(delta);
|
||||
if (!entity.position().epsilonEquals(entity.target())) {
|
||||
if (!entity.target().isZero() && !entity.position().epsilonEquals(entity.target())) {
|
||||
float angle = mapRenderer.angle(entity.position(), entity.target());
|
||||
entity.setAngle(angle);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user