L
Lennayy
Guest
Hello all, this is my first post so apologies if this is in the wrong place or badly formatted.
In my game, you fly a spaceship. This spaceship has multiple levels, but the ship as a whole stays in the same room (so your position in space and other objects in space don't change). I have sprites for the different levels of the ship and basic system for creating the various objects (wall blocks, doors, consoles, etc.) of each level, including their positions, using arrays:
An array is created using two for loops to generate grid coordinates, then each array entry is assigned a value of an object (e.g. array[1,10] = obj_block). Another two for loops are run to create the objects in their respective positions. Using this system I can have any number of ships, of any shape and size, but only have to use one room (which is useful given how I would like there to be one 'Space' room!)
I can also create different layers of the ship by having the array change based on the level you are on (basement, floor 1, top deck, etc.)
What I cannot figure out is how to make the objects on layers that aren't currently in use persistent, as you can do with rooms. I would like to have AI objects (cleaning robots, rogues aliens, computer malfunctions) on different levels that still function when you aren't on that level.
I have toyed with ideas such as making the levels all exist at the same time jumping their position to outside of the room when not on that particular level (shifting all instances of that level) but I fear I will run into complications later when dealing with collision checks with other ships that will be outside of the room.
I'm not sure with the current method I have if there will be a solution to this problem, or at least not a simple, easy to work with one.
Many thanks in advance!
In my game, you fly a spaceship. This spaceship has multiple levels, but the ship as a whole stays in the same room (so your position in space and other objects in space don't change). I have sprites for the different levels of the ship and basic system for creating the various objects (wall blocks, doors, consoles, etc.) of each level, including their positions, using arrays:
An array is created using two for loops to generate grid coordinates, then each array entry is assigned a value of an object (e.g. array[1,10] = obj_block). Another two for loops are run to create the objects in their respective positions. Using this system I can have any number of ships, of any shape and size, but only have to use one room (which is useful given how I would like there to be one 'Space' room!)
I can also create different layers of the ship by having the array change based on the level you are on (basement, floor 1, top deck, etc.)
What I cannot figure out is how to make the objects on layers that aren't currently in use persistent, as you can do with rooms. I would like to have AI objects (cleaning robots, rogues aliens, computer malfunctions) on different levels that still function when you aren't on that level.
I have toyed with ideas such as making the levels all exist at the same time jumping their position to outside of the room when not on that particular level (shifting all instances of that level) but I fear I will run into complications later when dealing with collision checks with other ships that will be outside of the room.
I'm not sure with the current method I have if there will be a solution to this problem, or at least not a simple, easy to work with one.
Many thanks in advance!