How to use a button multiple times

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

Could you tell me how to use a button to change sprite’s texture several times?
For example, let’s just that there is a button and when it is pressed, it changes sprite texture into png1. And then when I press it again, the sprite texture changes into png2.

:bust_in_silhouette: Reply From: Mrpaolosarino
If Input.is_action_pressed("Your Button"):
         your_function_for_changing_sprite()

This is for the button mechanics

For Sprite, I recommend just use animated sprite and then add create an animation. And after that, every time you press the button your frame changes by 1

Thanks , it helped me a lot.

Radgrid728 | 2021-03-20 01:56

glad to help

Mrpaolosarino | 2021-03-20 03:05