1. Hey! Guest! The 35th GMC Jam will take place between November 28th, 12:00 UTC - December 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

Handling Code for multiple levels

Discussion in 'Programming' started by Hadin, Feb 10, 2017.

  1. Hadin

    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.
  2. Gillen82

    Gillen82 Member

    Jan 30, 2017
    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.

    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.
  3. Hadin

    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.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice