Save and Load disk

This forum is currently in read-only mode.
From the Asset Store
Template for a generic save / load system, fully documented in comments and video
  • can someone tell me if there are other ways to save everything besides save / load disk, and then load again

  • Basically you'd store all the info you want to save (positions, variables, .. etc) in something that can saved to disk. Offhand the array object could be used. Then when you load the file later you can to take that info in the array and recreate and re position everything. That's the general idea, but really it can become as thorough as you want.

    So for example a save event would do this:

    Set array size to (0, 10, 1) 
    
    for each sprite
    --- array: push 0 to back
    --- array: set (array.width-1, 1) to "sprite"
    --- array: set (array.width-1, 2) to sprite.x
    --- array: set (array.width-1, 3) to sprite.y
    
    array: save to file[/code:75i6wn73]
    
    Then the loading would be something like:
    [code:75i6wn73]Array: load file
    sprite: destroy
    
    array: for each x
    array at (array,currentX, 1) equal to "sprite"
    --- system: create sprite at (array(array,currentX, 2), array(array,currentX, 3)) [/code:75i6wn73]
    
    It's a starting point anyway.  If it doesn't make sense then I think it explains why I'm on here less and less.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Basically you'd store all the info you want to save (positions, variables, .. etc) in something that can saved to disk. Offhand the array object could be used. Then when you load the file later you can to take that info in the array and recreate and re position everything. That's the general idea, but really it can become as thorough as you want.

    So for example a save event would do this:

    Set array size to (0, 10, 1) 
    
    for each sprite
    --- array: push 0 to back
    --- array: set (array.width-1, 1) to "sprite"
    --- array: set (array.width-1, 2) to sprite.x
    --- array: set (array.width-1, 3) to sprite.y
    
    array: save to file[/code:l83xbrq8]
    
    Then the loading would be something like:
    [code:l83xbrq8]Array: load file
    sprite: destroy
    
    array: for each x
    array at (array,currentX, 1) equal to "sprite"
    --- system: create sprite at (array(array,currentX, 2), array(array,currentX, 3)) [/code:l83xbrq8]
    
    It's a starting point anyway.  If it doesn't make sense then I think it explains why I'm on here less and less.
    

    I tried but I could not. I just do not know how to use the array plugin. Could you give me another example .cap mode?

  • I can't be much help since i don't have Construct classic installed and would need to re-familiarize myself with it. Aka figure out how many parts of it works, identify crashing points, and working around it.

    There is this old discussion with some examples and such. I fixed my links, i'm not sure about the others.

    Also maybe look at Jayjay's example kit in his signature. It may have something useful.

  • I can't be much help since i don't have Construct classic installed and would need to re-familiarize myself with it. Aka figure out how many parts of it works, identify crashing points, and working around it.

    There is this old discussion with some examples and such. I fixed my links, i'm not sure about the others.

    Also maybe look at Jayjay's example kit in his signature. It may have something useful.

    Thank you for sharing. I'll see what I can learn more.

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