• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Collision Layers (May be the wrong term)

D

DevLuke

Guest
So basically I have an object that I have set the collision mask to cover the entire screen, because that object needs to preform an operation anytime you click somewhere on the screen.

But I have icons on the screen for things like the menu and setting.

I was wondering how I could make it so that when I click on the icons it wont run that action for my main object?
 

Perseus

Not Medusa
Forum Staff
Moderator
Why are you using an object for that? Couldn't you just use a global mouse pressed event instead?

You could create a new object and set it as the parent of all the menu objects. In the said event, detect if you're clicking on one of these instances. If yes, then continue with a menu operation, otherwise execute the regular operation.

Code:
var inst = instance_position(mouse_x, mouse_y, obj_MenuParent);
if (inst == noone) {
    // Regular operation
}
Menu operations can be handled in the corresponding objects. Hope that helps.
 

Zerb Games

Member
I would do a simple variable.

Make a variable called window_focus.

then if mouse_box(//over button) {freeze = true} else {freeze = false}

For separate menus/windows
Then in the code do something like: if window_focus = "menu1" && mouse_box(21,21,48,48) && mouse_check_pressed(mb_left) {//event}

Here's mouse_box:
Code:
/// mouse_box(x,y,w,h)

return (mouse_x>=argument0 && mouse_y>=argument1 && mouse_x<argument0+argument2 && mouse_y<argument1+argument3 /*&& window_busy="" && popup_ani_type=""*/)
 
Top