I’m new to the forum so I opened the first topic wrong, now I decided to open the same topic more correctly.We want to develop a 2D game and we want to design our game’s UI main menu to interact with images like the picture below. I have reviewed Udemy, Youtube and many resources, but everyone has explained the main menu designs with the buttons, but we want to add the start and exit the game interactions with the pictures we designed. Apart from this, we always want to prepare the normal in-game features by interacting with the pictures I designed, but we could not find an educational tutorial or a resource on this subject.
I would like to emphasize that we will not design the main menu with buttons. We will add words such as “start the game” and “exit the game” at certain points in the pictures we designed. When the character moves his mouse to start the game, for example, if he is at the door, I want that door to open. When you click it, it will enter the game.
Can you tell me how I can solve this issue? or can you provide training suggestions that offer good trainings on this subject?
However, to make things more organised and organic, you would not use orphaned images as this would force you to repeat the script for each element (I mean, you can, but probably could invest your time better). It would become a tangled mess.
Instead, native elements (borders, images, buttons, panels, text…) are often grouped together and wrapped in user widget. Something along the lines of:
The script goes inside, into this interactive piece; and since this an entirely independent widget, we have much control over how it behaves. Each user widget can override (and / or add completely new functionality):
For example, overriding onMouse Enter/Leave would give you a chance to highlight the originally mentioned door or play an animation. Once you’ve scripted interactions you are happy with, populate the menu with those specialised user widgets:
Exposing data allows for customisation, here you could pipe in the desired image, tooltip text or colour of the highlight. At this point you can also start equipping those widgets with Event Dispatchers - they can start reporting to the main menu that houses them, turning it into a little data hub.
I can now customise this widget and, thanks to the user widget dispatching an event, it will be the main menu that decides what happens when this piece is clicked.