I need to add some buttons to my game, I would like my buttons to act as one.(mouse hover effect, click effect, text of button, etc…)
Is there going to a button object in the future? or maybe I can create one with creating a custom behavior on sprite? text?
Can I suggest it for future version?
There’s currently no button object that I know of, but you can add buttons as an image with sprites and use animations for hover effects, or as text. For hover effects on text, you’ll want to use the “cursor touch is on an object” condition, both inverted and not, then do color changes or apply other text effects (i.e., shadow) in the actions.
You can check out the menu example that’s included with GD, to see how the code looks. It was made with text objects, but you can still get an idea of how to do it.
I’m not sure if it’s planned to add button objects or not since you can use existing objects to accomplish this, but the devs are open to making improvements
Indeed you can do this by creating your own behavior on a sprite / text.
It would be easier to have a button object. But this is not on the agenda .
Ok thank you.
I’ll make my own behavior.
It will be nice to have sometime in the future objects like: button. list, text entry box…
then you can share behavours
I made it
Where do I share it
@Mlafefon the button object is really very helpful, but it seems is does not work with activate / deactivate behaviour.
When I assign it to one of my sprites and deactivate the behaviour “button” it is still clickable. Any idea how this can be fixed?