I want to be able to find out if a particular instance is active.
For my pause menu, I want to cycle through all active objects, store their IDs in a list. When coming out of pause I want to re-activate only those objects I de-activated, so I will cycle through the list and activate each one.
There does not appear to be an accessible property for an instance to see if it in particular is active or not.
Here are the available functions as far as I can see:
◦instance_activate_all
◦instance_activate_object
◦instance_activate_region
◦instance_deactivate_all
◦instance_deactivate_object
◦instance_deactivate_region
- Game Maker Community
- → Viewing Profile: Topics: thescotster19
thescotster19
Member Since 07 Mar 2006Offline Last Active Jun 03 2013 08:21 PM
Community Stats
- Group GMC Member
- Active Posts 236
- Profile Views 2057
- Member Title GMC Member
- Age 31 years old
- Birthday February 3, 1982
-
Gender
Male
-
Location
London, UK
-
Version
GM:Studio
8
Lookin' good!
Latest Visitors
Topics I've Started
Finding out if a particular instance is active
09 January 2013 - 06:22 PM
Problem Creating instances in new room
09 January 2013 - 05:06 PM
When I change to a new room and create a couple of instances, they don't appear.
I suspect I am doing something wrong with my code when I change room, it is the first time I have done it. Here it is:
I have debug code to state the room that has been changed to. I have added code to write something if a ShipPlayer or Camera exist, and it does not. There must be something I am doing wrong.
Debug draw code:
The debug being displayed when in the room, CORRECTLY:

Where are my instances?
I suspect I am doing something wrong with my code when I change room, it is the first time I have done it. Here it is:
if(newState)
{
// Set room for starting room
currentSector = sectorStart;
// Load starting ship
gridShip = loadShip("\ship.txt");
// Load any other starting details
shipX = 100;
shipY = 100;
// Load in new room
room_goto(currentSector);
// Create player in new room
instance_create(shipX, shipY, ShipPlayer);
//player.gridShip = gridShip;
instance_create(shipX, shipY, Camera);
// Change state to space or station, depending on starting settings
state = stateSpace;
}
I have debug code to state the room that has been changed to. I have added code to write something if a ShipPlayer or Camera exist, and it does not. There must be something I am doing wrong.
Debug draw code:
/// Draw debug info draw_set_font(fontMenu); draw_set_color(c_white); draw_set_halign(fa_right); draw_set_valign(fa_top); draw_text_color(window_get_width() - 10, 10, "Room: " + string(room_get_name(room)), c_white, c_white, c_white, c_white, 1); draw_text_color(window_get_width() - 10, 30, "State: " + string(state), c_white, c_white, c_white, c_white, 1); draw_text_color(window_get_width() - 10, 50, "Speed: " + string(room_speed), c_white, c_white, c_white, c_white, 1); draw_text_color(window_get_width() - 10, 70, "Room Size: " + string(room_width) + "x" + string(room_height), c_white, c_white, c_white, c_white, 1); if (instance_exists(Camera)) draw_text_color(window_get_width() - 10, 90, "Cam Pos: " + string(Camera.x) + "x" + string(Camera.y), c_white, c_white, c_white, c_white, 1); if (instance_exists(ShipPlayer)) draw_text_color(window_get_width() - 10, 110, "Ship Pos: " + string(ShipPlayer.x) + "x" + string(ShipPlayer.y), c_white, c_white, c_white, c_white, 1);
The debug being displayed when in the room, CORRECTLY:

Where are my instances?
Storing a script call in a ds_grid
07 January 2013 - 08:07 PM
I have a menu system, and the menu text is stored in a ds_grid, with an "ID" number.
When I draw the menu I cycle through the elements in the grid vertically and draw the text. I then check if the user has "selected" an item, and the "ID" of the selected item. Based on the ID I perform some code.
This is quite long winded and isn't easy to read.
What I would prefer would be to store the ID of a script for the selected item.
e.g element (0, 0) in the ds_grid would store the text "Resume Game" and (1, 0) would have the script ResumeGame().
Now when a user selects the item, I would simply call the script stored in ResumeGame(), with the vertical address of the selected item.
if (select) ds_grid_get(menu, selectedItem, 1);
It occurs to me it would be possible to create a game object that would perform each function, and store the object IDs, however I don't think that is particularly elegant.
Is anything like the above possible?
When I draw the menu I cycle through the elements in the grid vertically and draw the text. I then check if the user has "selected" an item, and the "ID" of the selected item. Based on the ID I perform some code.
This is quite long winded and isn't easy to read.
What I would prefer would be to store the ID of a script for the selected item.
e.g element (0, 0) in the ds_grid would store the text "Resume Game" and (1, 0) would have the script ResumeGame().
Now when a user selects the item, I would simply call the script stored in ResumeGame(), with the vertical address of the selected item.
if (select) ds_grid_get(menu, selectedItem, 1);
It occurs to me it would be possible to create a game object that would perform each function, and store the object IDs, however I don't think that is particularly elegant.
Is anything like the above possible?
room_add() - Set room speed
07 January 2013 - 05:05 PM
When I use room_add(), the new room appears to have a default room speed of 30. I am using 60 throughout my game, how do I set the room speed of the newly created room?
room_speed is read only, and only applies to the currently active room.
Any help appreciated.
room_speed is read only, and only applies to the currently active room.
Any help appreciated.
Maximum Room Size
02 January 2013 - 11:19 PM
I am sure this has been asked before, but I googled it and couln't find a definite answer.
I am working on a project that will require very large rooms. What is the limit to room size?
If I find the limit is more than I am happy with, can you think of any clever ways to switch rooms without the player noticing?
For an idea I am thinking something in the range of 500,000 by 500,000.
Thanks for any help
/>
EDIT: A little extra info, the room won't be particularly packed with objects, and anything in there will be deactivated when not in range, so this won't be the issue. The physical size is the key.
I am working on a project that will require very large rooms. What is the limit to room size?
If I find the limit is more than I am happy with, can you think of any clever ways to switch rooms without the player noticing?
For an idea I am thinking something in the range of 500,000 by 500,000.
Thanks for any help
EDIT: A little extra info, the room won't be particularly packed with objects, and anything in there will be deactivated when not in range, so this won't be the issue. The physical size is the key.
- Game Maker Community
- → Viewing Profile: Topics: thescotster19
- Privacy Policy
- GMC Rules and Forum Rules ·



Find content