Handling Code for multiple levels

H

Hadin

Guest
Unsure how to even phrase what I'm trying to find out thus why Google hasn't been a reliable method of obtaining the information. So what I'm asking, in a broad sense, is how you go about making a multi-level game. I understand how to set up a player character and give it interactions with things on the map, like new weapons and enemies and making all that work but how do you go about building scenarios and giving each level its own objective? Where do you place any code that's exclusive to the level so as not to clutter the player object with bits that are only necessary for one part in a single level? Sorry if I'm not making any sense, I'm really unsure what to even ask about. I just don't understand how to proceed now that I have some enemies and the player character set up and they can kill each other. I don't know where to even begin or what I'd use to make the codes be exclusive to the level they take place in.
 

Gillen82

Member
Would scripts be an option? Within the player step event, keep a track of what level (room) you are in, and load scripts according to the result.

Code:
if ( room = rm_level1 ){

    //Load necessary scripts here

} else if ( room == rm_level2 ) {

    //Load necessary scripts here

}
Probably how I would do it...but probably a different (and easier) way.
 
H

Hadin

Guest
Yeah, makes sense. I was thinking level controller objects that aren't persistent so they only work in the level they're in and the code works around the codes of the instances. That's about the best I can come up with. I'm sure I'll find something that works, was just wondering people's thoughts or if there was something more conventional that people usually learn.
 
Top