Fix AnimationRunner offset
This commit is contained in:
@@ -45,8 +45,8 @@ public abstract class BaseLayer implements Layer, Updatable {
|
|||||||
public void update(float dt) {
|
public void update(float dt) {
|
||||||
if(!animationsToAdd.isEmpty()) {
|
if(!animationsToAdd.isEmpty()) {
|
||||||
for(var animation : animationsToAdd) {
|
for(var animation : animationsToAdd) {
|
||||||
animation.setStepSize(stepSize.x(), stepSize.y());
|
|
||||||
animations.add(animation);
|
animations.add(animation);
|
||||||
|
animation.setStepSize(stepSize.x(), stepSize.y());
|
||||||
animation.onAdd(this);
|
animation.onAdd(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -114,17 +114,17 @@ public abstract class MovableSprite extends AnimatedSprite implements Movable, U
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPosition(float x, float y) {
|
public void setPosition(float x, float y) {
|
||||||
super.setPosition(x, y);
|
super.setPosition(x - positionOffset.x, y - positionOffset.y);
|
||||||
coordinates.x = (int) ((x - positionOffset.x) / coordinateStepSize.x);
|
coordinates.x = (int) (x / coordinateStepSize.x);
|
||||||
coordinates.y = (int) ((y - positionOffset.y) / coordinateStepSize.y);
|
coordinates.y = (int) (y / coordinateStepSize.y);
|
||||||
placingMode = PlacingMode.BY_POSITION;
|
placingMode = PlacingMode.BY_POSITION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPosition(Vector2fc position) {
|
public void setPosition(Vector2fc position) {
|
||||||
super.setPosition(position);
|
super.setPosition(position.x() - positionOffset.x, position.y() - positionOffset.y);
|
||||||
coordinates.x = (int) ((position.x() - positionOffset.x) / coordinateStepSize.x);
|
coordinates.x = (int) (position.x() / coordinateStepSize.x);
|
||||||
coordinates.y = (int) ((position.y() - positionOffset.y) / coordinateStepSize.y);
|
coordinates.y = (int) (position.y() / coordinateStepSize.y);
|
||||||
placingMode = PlacingMode.BY_POSITION;
|
placingMode = PlacingMode.BY_POSITION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user