Levels.... how???

This forum is currently in read-only mode.
  • Currently there are 3 options for levels in a game :

    1) Different layouts

    2) Arrays

    3) Built in Save/Load

    But I have to create a save file not too complex and not too simple. I have different objects on playfield and 3, 4 global variables. Is there any way I can save all to a text file like this?

    2 // number objects
    var1 // global var 1
    var2 // global val 2
    obj1x // ***
    obj1y
    obj2x
    obj2y[/code:5i6cqax7]
    
    *** = Construct reads the first line (2) and after reading the global variables it does a Repeat loop with (2 * 2). In fact, the repeat loop should work like this : 
    
    [code:5i6cqax7]read line 1 -> put in variable 1
    NEXT LINE
    read line 2 -> put in variable 2
    spawn object at var1 var2
    NEXT LINE - REPEAT[/code:5i6cqax7]
  • I would use Ini files for stuff like that really, it allows you to save the information with a little structure and doesn't take much work to achieve what you want.

    Edit: Ill give a small example

    [Global]Var1 = variable
    Var2 = variable
    NumObjs = 2
    
    [Obj1]
    X = ***
    Y = ***
    
    [Obj2]
    X = ***
    Y = ***[/code:3amtz2po]
    
    Although you would probably need a "TypeObj" in each Obj group so you can create more than one type of object.
  • I don't really get INI object...

    I want something like :

    Read line X

    Read next line

    Not groups stuff... But if you can demostrate me with an example...

  • This is exactly what I've been trying to do. Only I've been attempting to use arrays and have one for each different type of object. So far I've failed epically and doing this.

  • Not groups stuff... But if you can demostrate me with an example...

    Ok i'll see if I can whip something up for ya, you want it to be able to define how many objects there are and where they are placed, from the INI file right??

  • > Not groups stuff... But if you can demostrate me with an example...

    >

    Ok i'll see if I can whip something up for ya, you want it to be able to define how many objects there are and where they are placed, from the INI file right??

    I just want this :

    NumberObjs = 2

    Obj1X= 3

    Obj1Y = 5

    Obj2X = 6

    Obj2Y = 7

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Cool, should be simple enough

    EDIT: Here you go, even supports placement of two different objects (although it will work with the same object)

    http://www.scirra.com/phpBB3/viewtopic.php?f=16&t=1721

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)