0 votes

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.

Godot version 3.2.3
in Engine by (21 points)

1 Answer

0 votes
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

by (378 points)

Thanks , it helped me a lot.

glad to help

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.