Topic was automatically imported from the old Question2Answer platform.
Asked By
Captain.Susuwatari
Hi,
i’d like to have Zelda-Like moveable Blocks which can be pushed.
While they are being pushed, they should be animated lke they’re vibrating/shaking.
Can this animation be done by adding a Tween (how?), or should i go for ‘updating to random positions while a Timer plays’.
What is the better approach for this structure…?
Assuming the shaking is just for visual effect and doesn’t actually impact game play or the interaction with the blocks, why not simply animate the sprite object itself? As an outline:
Create a suitable “shake” animation for the block’s sprite
Set it to loop
When the block push starts, play the animation using $AnimationPlayer.play("yourAnimation")
When the block push stops, stop the animation with$AnimationPlayer.stop()
Thank you, to pick the Sprite Child is the key! (Because I’m already using AnimationPlayer to change position of the KinematicBody2D, changing the sprite’s position doesn’t affect the rest like the collider etc…)