GameMaker: Studio

GameMaker: Studio

View Stats:
Horsecock 12 Apr, 2015 @ 1:55pm
How do i make an object visible in a certain room but invisible in others?
I am creating a game and in this game i have an object persistent so it goes from room to room. The object doesnt have a fuction when it is outside it's main room. It needs to be visible in a certain room, but invisible in other rooms. I have to make it persistent to allow it to keep a global variable the same as it was in it's main room. So if anyone can explain to me how to make an object only visible in a certain room, that would be fantastic! Thank you for listening.
< >
Showing 1-5 of 5 comments
Blind 12 Apr, 2015 @ 1:59pm 
You can simply do Visible=false, note: If an object is not visible it will not perform its Draw step, if you are using an object to control lighting/shadows
Chase of Bass 12 Apr, 2015 @ 7:46pm 
yea and you can throw a conditional check on the room so it'd be like:

if room = your_room_name
{
visible=false;
}
Horsecock 12 Apr, 2015 @ 7:57pm 
ok i figured it out now. Thank you both!
hell yeah
The Winter Bud 29 Sep, 2024 @ 3:13pm 
For those of you who need another solution here's another

the only issue with using
visible=false;
is that the object is still in action (if that's what you want). The object will still perform actions in it's events, including click and key events. It just wont draw itself.

another solution is to use something like
instance_deactivate_object(obj);
This way the object isn't doing anything and taken out of the game. You can always bring the object back with
instance_activate_object(obj);
Last edited by The Winter Bud; 29 Sep, 2024 @ 3:14pm
< >
Showing 1-5 of 5 comments
Per page: 1530 50