Level Handling

edited June 2012 in General discussions
Sup guys, so I was wondering as my needs for using this engine include using multiple "levels" or maps if you will, whats the best way of handling multiple play areas. I know that Scrolls does this, which I'm working on implementing, but I wanna know how to do it another way, just to keep options open.Thx in advance. :laugh:


  • edited June 2012
    Well, first you need to destroy/delete all the objects you've created (or at least the ones concerned with my level), then you need to recreate new objects to set up a new level.

    Easiest way is probably to create an [level1] object in your ini files setting up all the objects, and a [level2] etcetera. When creating a level, you just CreateFromObject("level1"), and it'll spawn your entire level into life.

    Of course, after this you'll probably need to iterate the Objects to setUserData if you're using that.
  • edited June 2012
    Or you can listen to orxOBJECT_EVENT_CREATE, if you'd rather. :)
  • edited June 2012
    If you delete the parent, the children don't die? I just want to make sure before I go and write a whole bunch of non-functioning code.
  • edited June 2012
    In Equilibria, I create and destroy C++ class instances that are responsible for creating and destroying anything that needs to be used in the level.

    If I were starting a new game today, I'd use Scroll's map loading functions. I've never used this, actually. It may be the subject of my next Scroll tutorial once I finally try it out.
  • edited June 2012
    Well, it depends what you mean by parents.
    If you mean parent in the frame hierarchy sense, no there's no linked deletion.
    However deleting an object that owns other objects (think orxObject_SetOwner and ChildList property) will trigger their deletion as well.
  • edited June 2012
    So I was thinking as orxd.ini defaults to orx.ini for framing and objects and whatnot, could there be a way to reference say level 1 in the main ini to something like lvl1.ini?
  • edited June 2012
    I'm not entirely sure, but you could try copying the code in the orxd.ini and replacing orx.ini with lvl1.ini, lvl2.ini etc.

    However, you should probably consider the lvl files as separate files, so that'll only work to make a list of levels outside of the program's code. I wouldn't do something akin to:


    that's bound to weird results

    (Note: That was pseudo code, plz have a look at that ini file for the real code.
  • edited June 2012
    Heh, well I just found something similar to what I was thinking about which was covered in Grey's great tutorial here if anybody was wondering, I'll probably just as soon use scrolls but I just wanted to see what some of you guys thought.
Sign In or Register to comment.