Can anyone tell me what exact the mouse released event do ? i have left click in object then released but the code in mouse released event not running.
Thanks for advance !
mouse release or global mouse release? Both events need the specified mouse button to be released. Global will trigger any time that mouse button is released, non global will trigger only if the mouse is currently 'colliding' with the object which means that the object needs to have a valid mask (which by default any object with a sprite would as defined in the sprite editor).
Remember to read the manual as well.
https://docs2.yoyogames.com/source/_build/2_interface/1_editors/events/index.html
The left
, right
and middle
button events (whether normal, pressed or released) all work on the mask of the instance that has the event. What this means is that
GameMaker Studio 2will check the position of the mouse in the room when those buttons are used against the collision masks of the instances that have a mouse event. If there is a "collision" then the event will be triggered, so make sure that any instance with these events has a sprite with a valid mask or that the object has a mask selected in the object properties. As their names imply, these events will be triggered either once when the chosen mouse button is first pressed or released, or continuously each step while the button is maintained.
The mouse enter and leave events are also similar to the button events in that they too rely on the mask of the instance to work, but this time they are triggered when the mouse first "enters" (touches) the instance or when the mouse "leaves" (stops touching) the instance. These events are not continuous however, and are triggered only once for each time the mouse enters or leaves the object - so they are an ideal method for creating, for example, buttons that need to change as the mouse hovers over them before going back to normal when the mouse is removed.
Finally we have another section to the mouse events which is called the
Global Mouse. In this sub-menu you will find a selection of events that are for recording mouse events in instances even when the mouse is not over them or even near them. These are events that are generated for all instances and if there are actions or code defined for the specified event then it will be run, regardless of the position of the mouse within the game room.