mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-03 20:36:31 +08:00
Ensuring final position and size for MoveEffect and ScaleEffect
This commit is contained in:
@ -14,7 +14,7 @@ class MyGame extends BaseGame with TapDetector {
|
||||
add(square = Square()
|
||||
..anchor = Anchor.center
|
||||
..x = 200
|
||||
..y = 400);
|
||||
..y = 200);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -61,6 +61,9 @@ class ScaleEffect extends PositionComponentEffect {
|
||||
|
||||
component.width = _original.width + _diff.width * c * _dir.x;
|
||||
component.height = _original.height + _diff.height * c * _dir.y;
|
||||
} else {
|
||||
component.width = size.width;
|
||||
component.height = size.height;
|
||||
}
|
||||
|
||||
_ellapsedTime += dt;
|
||||
@ -120,6 +123,9 @@ class MoveEffect extends PositionComponentEffect {
|
||||
|
||||
component.x = _xOriginal + _xDistance * c * _xDirection;
|
||||
component.y = _yOriginal + _yDistance * c * _yDirection;
|
||||
} else {
|
||||
component.x = destination.x;
|
||||
component.y = destination.y;
|
||||
}
|
||||
|
||||
_ellapsedTime += dt;
|
||||
|
||||
Reference in New Issue
Block a user