New extension for Sprite Buttons

Hi there!

I made a very easy to use Sprite Button Extension.

Since it’s super easy to make and I did not find an official version. And now after checking on the forum the ones that are out there seem to have minor issues.

You can download this behavior here:
(removed google drive link for privacy reasons. Feel free to comment if you want a new link to download it)

You have a sample project here:
(removed google drive link for privacy reasons. Feel free to comment if you want a new link to download it)

It is super easy to use and completely customizable.
You can
+check weather a sprite button is clicked or being pressed
+set hover/press animations
+set the movement offset when clicking the button
+activate/deactivate the button behavior
+separately activate/deactivate the button animations, without deactivating the button behavior itself,
+check with which mouse button the sprite button was clicked
etc.

So fully customizable and easy to use.

It’s also set up in a way so that you can move the button in-game, and the movement offset when clicking still works totally fine. This allows you to use the buttons with the object drag behavior for example or any other extensions.

Let me know if it helps you, I’d be happy to know.

89eeb0c9cf9fc250b8118ba74a65123c



I’ve been looking for a good button extension for my project. I personally have my eye on this one:

I wonder what the differences are between the two… How does yours handle clicking off the button, then dragging over it? Or clicking on the button, then dragging off it?

Well on first look mine is more intuitive and easy to understand and simple to use.

It is also way faster. It automatically changes the animations, and you don’t need to code a single thing for it, unlike the extension you linked. (changing animation is optional btw. in my extension, only if you set animations for the button).

I used the same style as standard Gdevelop to again make it a piece of cake to understand.

I would say the extension you linked is for very specific usage, not for easy button creation.

Also in this new extension you can customize everything and have all the control over everything. You can pick which mouse button is used to click. You cannot do that with the other extension. Also you cannot set an offset for the movement (how much the button moves when hovering, clicking). In my extension it’s all automatic and customizable. And all the other features I listed above are not available either in the linked extension.

Regarding the clicking behavior:
When clicking the button and then dragging off, the button jumps back to normal as if not clicked, the click event will not trigger. However as long as the pressed mouse is over the button, the press event triggers.

Regarding clicking outside the button:
Because of your question I added a new feature: Allowing Dragging click:

If this option is not ticked, then when you click outside the button and drag inside, the button will not get pressed, but hover, to signify that you can click it.

If this option is ticked, then when you click outside the button and drag inside, the button will get pressed (but not clicked yet) and as soon as you release it’s a click!

What behavior are you looking for specifically?
I might just quickly add that to the extension.

Edit:
Also in my extension you can super easily just deactivate all sprite button events you created.
Then no clicking/pressing event triggers anymore.
And you can deactivate button animations while still keeping the clicking behavior.

And I will extend it to also work on tiled sprites and texts.

1 Like

I updated the link, you can download the updated extension now.

Text objects and tiled sprites do not currently have the option to toggle off dragging clicks.

I have added the functions and conditions.

You can now set and check and change and customize all the button functions in game :wink: