Reset layout and instances?

0 favourites
  • 8 posts
From the Asset Store
MM_Preloader
$19.99 USD
Various preloading features. Preload textures of entire layout, custom preloading, etc.
  • My layout loop looks like this:

    Intro->Main game->High Score list->back to Intro

    The Main game layout is a huge level with sprite instances created inside the editor. The first time through everything works as expected. But once I reach the High score and then return for a second playthrough some of the sprite instances have disappeared.

    Is there a way to do a clean reset of the layout so it's exactly the same as it was the first time through ?

    I am calling System.ResetGlobalVariables after the High Score layout but still occasionally some of those original sprites don't show up.

  • Hmmm can't give a usefull answer, it's probably due to some ways you create your sprite. Or some ways you destroy them. Can't say much with only what you said.

    Might be a good idea to post the capx. Even screenshots might not be enough.

  • I am doing weird things with my sprites during gameplay, but my question is this:

    Once the level is complete, how do I completely reset a layout to its original state?

  • System: Reset global variables

    Objects: Put back instances variables to their default value (you have to handle it yourself)

    System: Go to layout "current layout"

    But as Yann said:

    It's probably due to some ways you create your sprite. Or some ways you destroy them.

    Can't say much with only what you said. Might be a good idea to post the capx.

  • If you don't use global objects, just reseting global variables should be enough.

    If you use global objects it's a bit more complicated.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yann:

    No global objects, and I am calling "reset global variables" after the level is done.

    Kyatric:

    Can't post the capx due to copyright issues (artwork is done by client, not by me)..sorry. Here's a description of what's going on:

    the game is basically a shoot'em up like the Space Blaster example. In the editor I have placed about 70 enemy sprites with some instance variables like health, point value, etc.

    As the player scrolls along, the enemies come into view. Once they do I start their custom movement and the player tries to shoot them. Once the enemy health reaches 0 or when it leaves the layout I destroy the enemy.

    Eventually I do a goto Layout ("Game Over") followed by resetting global vars and then return to the same level, i.e. goto Layout("Main"). At this point MOST of the enemies seem to have been reset. But some no longer show up.

  • Kyatric:

    Can't post the capx due to copyright issues (artwork is done by client, not by me)..sorry.

    In that case, just reproduce in a new capx with placeholder graphics. (or modify the graphics in the current project and save as a new capx)

    I even prefer placeholders, it's quicker to download.

    Also when you say "I have placed about 70 enemy sprites" are those different objects or instances ?

    Once again, without the capx it's near to impossible to say exactly what's going wrong.

  • I�ve been having the same problem. I�m using a global variable to set the score and to be able to paste it in another layout (score table). But when I use "reset global variables", nothing happens. And when I jump from menu layouts to gameplay layouts all events are not reset.

    Should I reset manually the global variables, like "set value = 0" or something like that?.

    Thanks.

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