I made a level editor using arrays, and it works fine and all, but I want my engine to be able to load and hook multiple levels together. doesn't sound too hard (I did it before with inis) but the problem I've been running into, is that for obvious reasons when the tiles are loaded they paste themselves into the background and die. sounds great and all, but once the pasted tiles go off the screen it's curtains for them as well...
so how would I go about loading the only part of the level that the screen is currently on? or is there a way to paste objects with out them dissapearing everytime?
This is only a bandaid solution, but I'd simply tell them not to paste into the background if they're outside the playfield, and then when they enter, paste and destroy. Or, better yet, simply turn invisible so they can re-paste themselves when the edge of the play area passes them again.
Not great if you have enemies moving off-screen or something.
Daniel is exactly right. On the subject of storing multiple levels in one array file, I call this 'multiplanar' level design, and it works best with a system that uses strings as keys rather than numbers (I use Associative Array for this).
Basically, I name my keys in this format within AArray:
plane_x_y
where 'plane' is the name of the level/plane/dimension being defined, and 'x' and 'y' are obviously the tile coordinates. The tile parameters are then stored as the text value for that key. So the keyname for a tile at 32x256 on a plane/level named 'LevelOne' would be:
LevelOne_32_256
You then use 'add backdrop' to paste the object into the frame, and it won't ever get deleted again.
The cooler thing is that even though there is now NO way of accessing info about that tile from the standard event editor... we still have a record of its location and EVERY other variable parameter in the AArray... so if every background tile is 32x32, we can look up (x("player") mod 32) by (y("player") mod 32) and find out what tile the player is standing on! Even though it's a backdrop object now!
Think of the uses! You can make the player swim, make his physics change on different surfaces, make his footsteps sound different, you can do ANYTHING!
As you can see, I swear by custom level editors. They rock. And Rule. All day long.
ah thanks guys. you seem to be the man to see about level editors as well.
I have mmf 1.5... I remmember the backdrops dissapearing when I pasted them into the back ground...
but how would you go about level linking?
like, how would you refresh the board so that the old loaded levels are gone?
I don't think the method that Dines uses is very good... associative containers are very slow in comparison to normal arrays. What's wrong with saving levels to disk and loading them when necessary? (You could even load them to memory if you needed to...)
if ass arrays are anything like PERL hash arrays then yes it's a very slow method
Edited by the Author.
"Say you're hanging from a huge cliff at the top of mt. everest and a guy comes along and says he'll save you, and proceeds to throw religious pamphlets at you while simultaniously giving a sermon." - Dustin G
most classic NES and SNES games (I'm speculating) dont just load the whole smokin' level, it only loads the part that's currently on screen. what I'm planning on doing is making a map file in array format that tells the client what levels to load and such.