I have added in sprites to my game that are used as clickable menus, and when I click out of the menu, the menu closes. Awesome.
My problem is that the clickable area for the menu is larger than the menu itself. As you can see here:
Other than editing the image itself to give it a smaller canvas size, is there a way to change the clickable area of a sprite from within GDevelop? Thanks!
Double-click on the “menu” object in the Object’s editor pane to open the “Edit the sprite object” window. Then click on the icon that is diagonal lines in a square (near top of the window). The current hitbox for that object should now be shown.
In the Collision masks pane at the bottom of the window, click on the word default.
Then click on the second icon from the left (green cross with blue line and red dot) This should make a rectangle (with blue dots at the corner) appear over the menu object. You can now drag the blue dots of the hitbox with the mouse to make the hitbox smaller.
If you want to keep it as a rectangle it might be easier to just change the X and Y numbers corresponding to the four corners, rather than dragging.
Thanks Matt.
I updated the hitbox with what I want it to be, but the game still registers the “menu” as larger than it really is.
Here is my code (if that is my issue)
It seems I got it working.
I couldn’t figure it out within GDevelop, so I edited the canvas to be the size of the image (in a picture editor).
When I added the sprite back in, it worked perfectly.