This shows you the differences between two versions of the page.

Link to this comparison view

gdevelop:tutorials:creatingbuttons [2015/05/18 12:28]
gdevelop:tutorials:creatingbuttons [2015/05/18 12:28] (current)
Line 1: Line 1:
 +====== Creating buttons for a menu ======
 +Creating a button is very simple: Just add a Sprite object with 3 animations:
 +  * In animation 0, put an image of the button.
 +  * In the second animation, put an image of the hovered button.
 +  * Finally, in the third animation, put an image of the pressed button.
 +Then, using the events, just check if the cursor is on the button and if the mouse left button is being clicked, and change the animation accordingly:​
 +{{ gdevelop:​articles:​buttonevents.png?​nolink |}}
 +There is a more advanced example called "​Buttons.gdg"​ bundled with GD: In particular, you can use **groups** to generalize these events to all your buttons.