Arrays and Loops

This forum is currently in read-only mode.
  • What I'm attempting to do in this cap is save the location of every sprite instance and load it back in when a user returns to the layout.

    So far I have been able to do this with only one instance when I was using a slightly different structure and I can't figure out why I cannot do it with more than one.

    I must be missing something to have had it half working so any help is appreciated. I tried my best to explain my methods in the cap file itself. Thanks for your time!

  • I couldn't really make any sense of your CAP, but I can tell you that when positioning the blocks after array loading, you don't want to use the For Each action, otherwise all blocks will be moved to that position. Anyways, I whipped up a quick example that will do what you want to do in only 2 events(one for saving, one for loading):

    Array Loading Example

    Hope that helps.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What does setting a space on the index to "sprite", do?

  • That's just to tell it that there is coordinate information below that cell. If it sees "sprite" in a cell, it will create a sprite and set it's X and Y coordinates to the values in the cells below "sprite". That's the best I can explain it. There are probably better ways to do it, though.

  • [quote:1jb05inn]I couldn't really make any sense of your CAP, but I can tell you that when positioning the blocks after array loading, you don't want to use the For Each action, otherwise all blocks will be moved to that position. Anyways, I whipped up a quick example that will do what you want to do in only 2 events(one for saving, one for loading):

    Array Loading Example

    Hope that helps.

    Link is down.

  • The link is down because he made this http://www.scirra.com/phpBB3/viewtopic.php?f=16&t=1478

    Which is loads better.

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