Loading/Destroying an active on frame restart?

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • I had trouble keeping the title brief, so I apologize if the actual problem seems different to the title.

    I'm currently implementing item pickups in my game, with 1ups being placed in fixed locations around the map. There is only one actual 1up object that is copy/pasted around in different places.
    The problem I'm having is whenever the player dies, the frame restarts and loads from the last checkpoint using the ini object (i'm not sure if the ini object is even relevant in this situation) I want the game to remember which 1ups the player has already picked up, and whenever the frame reloads, the 1ups that have been collected are no longer loaded.

    Any tips? I've been stuck and have no idea how I should go about this, even thought it seems so simple.

  • You can use global values. They are not reset when you restart a frame, regardless of how your restart it, unless you manually reset them.

    So spread a value into all your pickups and if a pickup with alterable value 1 for example is picked up, then set the matching global value to 1.

    At the start of the frame only create those pickups where the global value = 0 and / or destroy those pickups where the matching global value = 1 (depending on how you're creating them).

    (For example if global value = 1 + a pickup's alterable value = 1 then destroy object with alterable value 1)

    When the frame is successfully completed - reset the global values to zero so that the next time all the pick ups are there again.

    (This also depends on how you're using your ini file - as long as you're not resetting the global values in the ini file - this will work.)

    Casual games: Please login to see this link.

  • If you want the game to remember which objects have been collected even after the game closes you could use: Storyboard Controls > Save Frame Position or Load Frame Position. Another method would be to gather all the objects Fixed Values and save that to an array or to another type of file. Then Start of Frame run a loop to check the list and delete which objects (based on Fixed Values) have been grabbed.

  • Since you're already using the ini object for checkpoints, you could also use the ini to track whether an item has been picked up, and start of frame destroy that object. If you have a lot of objects to track though, an array would be easier.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!