How do I save blocks to an array then to a file [Fixed]

0 favourites
  • 5 posts
From the Asset Store
Source code, art assets and music tracks to remake this game
  • Hey

    I am trying to make a level editor were you can save the map, to a json file then loaded it back from that file to be played normally. Like mario maker.

    I have seen some other post just like this one but I keep getting stuck and their old so I thought it would be better to start a new post.

    So far I have got it to save all the block locations but the only block which saves the right position is the last one, all the others are 1,1.

    I also have made it to be able to read the file then place the blocks in the right place(Thats how I knew it wasn't saving the array right).

    Thanks in advance

  • Please provide a new download link/URL, it doesn't appear to work.

    However there is one reason why it could be saving just one block, you need to do the saving action for each block objects, so a for each loop needs to be used. This is usually the case when an action is done just for one object correctly in an event, and what you are describing basically requires the use of a for each loop.

  • Please provide a new download link/URL, it doesn't appear to work.

    However there is one reason why it could be saving just one block, you need to do the saving action for each block objects, so a for each loop needs to be used. This is usually the case when an action is done just for one object correctly in an event, and what you are describing basically requires the use of a for each loop.

    I have updated the download link. (https://www.dropbox.com/home?preview=Sa ... arrays.rar)

    I have currently used a for each block loop, and its creating the right amount of data in the table, it's just not storing the right numbers in the array.

    Also I would add screen shots, but I am not sure how to add them to the scirra forums, do I have to upload them some where else and link it?

  • The link still is not valid/complete.

    There is a "shortage" around the name (where there are the ...).

    Post a complete link if you want others to see your project.

    And yes, screenshots need to be uploaded on a distant service and linked in the post using :

    [img]LinkToImage[/img][/code:xrwl7s9m]
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The link still is not valid/complete.

    There is a "shortage" around the name (where there are the ...).

    Post a complete link if you want others to see your project.

    And yes, screenshots need to be uploaded on a distant service and linked in the post using :

    [img]LinkToImage[/img][/code:fih34k81]
    

    Yeah, reread the link and its been cut.

    But I have managed to fix it.

    I miss under stood the function of push in the array. I thought where it says value is how many you want it to push, but its the value to go in the one you have pushed.

    Thanks

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