Godot Version
Godot 4.3 [Linux]
Question
I am using a Sprite2D (in fact three) with an AnimationPlayer to create a resizable animated laser/blast. I want to limit the extent of the laser to the point where it hits the nearest wall. I do this in the _physics_process
function, as it does not seem possible to check for collisions in _ready
.
My code works, but there always seems to be a single frame at the original extent of the Sprite2D before it gets resized. Is this expected behavior and is there a way I can avoid it?
Thank you for any suggestions!
Are you trying to adjust the size before it’s displayed? It sounds like you haven’t set the size as you want it in the sprite scale settings.
I adjust some sprite settings in one of my demos, but that’s after it’s displayed.
Yes, I want to resize it before it is displayed, i.e. the animation starts playing. I am not sure what you mean by setting the size as I want. There is no fixed size the blast should first appear at, it is supposed to be at its maximum extent or shorter if there is a wall in the way.
I found a way to fix my problem though. I had a texture set before the AnimationPlayer starts changing it. By using an empty ImageTexture instead, I avoid the first frame at the wrong extent.