mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-13 03:10:42 +08:00
Improve default constructor for positioned components (#667)
This commit is contained in:
@@ -20,9 +20,11 @@ class MyGame extends BaseGame {
|
||||
jsonData,
|
||||
);
|
||||
final spriteSize = Vector2.all(200);
|
||||
final animationComponent =
|
||||
SpriteAnimationComponent.fromSpriteAnimation(spriteSize, animation)
|
||||
..position = size / 2 - Vector2.all(100);
|
||||
final animationComponent = SpriteAnimationComponent(
|
||||
position: size / 2 - Vector2.all(100),
|
||||
size: spriteSize,
|
||||
animation: animation,
|
||||
);
|
||||
|
||||
add(animationComponent);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user