[Feature request] Reset Obj with 'Persist' behavior

0 favourites
  • 11 posts
  • Hello,

    The permanent objects (obj with Persist behavior) are great when you want to save the state of different elements when you reload a layout.

    But, unless I missed something, there's no way to reset their state.

    Here is the basic issue you will get if you make a game with permanent objects :

    -You launch your awesome game

    -You click on Start a New game

    -You play a little and move some permanent obj

    -You pause the game and click on "go back to main menu" (very common thing in videogames...)

    -You click on Start a New Game

    -Hooo.... the permanent objets stayed in their last state.

    So I think it's important to have the possibility to :

    *Reset ALL permanent OBJ

    *Reset a specific permanent OBJ (can be useful too, for example, a puzzle game with multiple layouts)

    What do you think ?

  • Do you mean global objects that you're using to hold game information in object variables? On start you can save their states as json, into global variables or an array / dictionary / web storage. Then, to reset, just load the original states back in...

    Edit to add: So you could use an array to save the player data at the start of each layout, giving you more control over how you reset things.

  • To make the menu / options easier to manage, I draw those now in a global layer so they can be exposed at any time in the game. That way you only need to set the game timescale to zero before showing the options layer. Easier than saving the player and enemies game data and then reloading it all on return to the layout.

  • Do you mean global objects that you're using to hold game information in object variables? On start you can save their states as json, into global variables or an array / dictionary / web storage. Then, to reset, just load the original states back in...

    Edit to add: So you could use an array to save the player data at the start of each layout, giving you more control over how you reset things.

    I think he is talking of the persist behavior, where the state of the objects with it are saved constantly, which is a great tool but lacks indeed this essential reset feature IIRC.

  • I think he is talking of the persist behavior, where the state of the objects with it are saved constantly, which is a great tool but lacks indeed this essential reset feature IIRC.

    Ahhh - that makes more sense. And is why I personally don't use the persist behavior...

  • Yeah sorry, it wasn't clear. (I've edited my post)

    I'm talking about the Persist Behavior.

    It's super useful when you have a lot of movable/destroyable objects in your game. You just tag them with the Persist behavior and they automatically remember their state. But the fact we can't reset that state is a lack.

    And I have to admit manually saving their state as a Json is a pain in the ass for me (I gave up). That behavior avoids doing that.

    It just needs a reset function to be perfect.

  • The easiest way to implement this is an action to reset all persisted instances globally. I'll see if I can get that in the next beta (note we are due a stable update next and I prefer not to make any changes at all for that).

  • Ashley Awesome!

  • Bump,

    I honestly thought a feature like this would already be included??? Why has it been taking so long.

    I am looking forward to it coming out and if it already came an can someone aleert me??

    I haven't been able to find it

    System action: 'recreate initial objects'. Recreate the initially placed objects in the layout for a specific object type or family within a rectangular area. (Note this does not destroy anything, it only creates new instances.)

    Mot sure if this is it?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Bump,

    I honestly thought a feature like this would already be included??? Why has it been taking so long.

    I am looking forward to it coming out and if it already came an can someone aleert me??

    I haven't been able to find it

    System action: 'recreate initial objects'. Recreate the initially placed objects in the layout for a specific object type or family within a rectangular area. (Note this does not destroy anything, it only creates new instances.)

    Mot sure if this is it?

    the feature this topic is about has arrived in r191, it did not arrived yet in a stable version though.

  • Ah okay thanks , i 5 minutes ago upgraded to 192

    I am so happy now i can finish my game

    Thaks, Scirra!!!

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