How to use AnimatedSprite in Pressed Textures of TextureButton, or should I be using something else?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By JoeSeki

I’m using a TextureButton and I want the following functionality.
On the Textures.Normal I want a single sprit image (no problem, that works).
On the Textures.Pressed, I want an Animated Sprite. I can’t get this to work. It wants AnimatedTexture with is a static sprite that you animate through its process. I want to use an AnimatedSprite that has it’s own Animation states. Depending on how long the button is pressed I want to change the animation based on the AnimatedSprite states.

How do I use an animated Sprite in the Texture.Pressed?

:bust_in_silhouette: Reply From: Bot7

I think you can do it when you make a Animationplayer.

if Button_pressed:
$Animationplayer.play(“test”)

I can’t get this to work.

I have 4 sprites that create the animation. It is not just a simple slide or rotation of one image. I see no way to use and animatedsprite with animationplayer.

JoeSeki | 2021-01-10 19:05

This doesn’t seem to work.

JoeSeki | 2021-01-10 22:08

:bust_in_silhouette: Reply From: JoeSeki

This worked like a charm!

I used the following tree
Node2D
-Button
-AnimatedSprite
-Timer

I made the button transparent by using the inspector->visibility->modulate and set the A channel to 0 making it transparent. This allowed the button to receive the signals. I think made the button the same size as my sprite and put them on top of one another. Using the timer I was able to animate the sprite when I needed to, depending on the timing of signals from the button