On my intro screen, I have users choose a level. When the mouse hovers over a level, I want an object (obj_points_per_level) to pop up with some info regarding that level. When the mouse isn't hovering over the level the pop up should be destroyed.
I created an obj_points_per_level with different sprites to display the info for each level.
The problem I am encountering is that it will only popup when I mouse over one of the levels and not the other. I imagine the reason is because I wrote that when the mouse isn't hovering over the obj_letters, the obj_points_per_level gets destroyed. Which must be overwriting the code (to create a new obj_points_per_level) when the mouse hovers over the obj_words. I just can't figure out a solution. Is there a more efficient way to do this, perhaps using a switch?
This is the code that I have (I'm trying to keep the code all in one object - obj_choose_level). Note, I will add more code with the other levels once I have the proper code
if popup == false {with (obj_points_per_level)instance_destroy(); popup = true;}; //popup is initialized in the create event
with (obj_letters)
{
if position_meeting(mouse_x,mouse_y,obj_letters) && obj_choose_level.popup = true
{
instance_create(x,y-70,obj_points_per_level);
with (obj_points_per_level){image_index = 1};
}
else if !position_meeting(mouse_x,mouse_y,obj_letters){obj_choose_level.popup = false};
};
with (obj_words)
{
if position_meeting(mouse_x,mouse_y,obj_words) && obj_choose_level.popup == true
{instance_create(x,y-70,obj_points_per_level);
with (obj_points_per_level){image_index = 1};}
else if !position_meeting(mouse_x,mouse_y,obj_words){obj_choose_level.popup = false};
};
I created an obj_points_per_level with different sprites to display the info for each level.
The problem I am encountering is that it will only popup when I mouse over one of the levels and not the other. I imagine the reason is because I wrote that when the mouse isn't hovering over the obj_letters, the obj_points_per_level gets destroyed. Which must be overwriting the code (to create a new obj_points_per_level) when the mouse hovers over the obj_words. I just can't figure out a solution. Is there a more efficient way to do this, perhaps using a switch?
This is the code that I have (I'm trying to keep the code all in one object - obj_choose_level). Note, I will add more code with the other levels once I have the proper code
if popup == false {with (obj_points_per_level)instance_destroy(); popup = true;}; //popup is initialized in the create event
with (obj_letters)
{
if position_meeting(mouse_x,mouse_y,obj_letters) && obj_choose_level.popup = true
{
instance_create(x,y-70,obj_points_per_level);
with (obj_points_per_level){image_index = 1};
}
else if !position_meeting(mouse_x,mouse_y,obj_letters){obj_choose_level.popup = false};
};
with (obj_words)
{
if position_meeting(mouse_x,mouse_y,obj_words) && obj_choose_level.popup == true
{instance_create(x,y-70,obj_points_per_level);
with (obj_points_per_level){image_index = 1};}
else if !position_meeting(mouse_x,mouse_y,obj_words){obj_choose_level.popup = false};
};