Destroy an object forever

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.
  • Hello, :)
    I am making a platform game for ANDROID with differents frames (that are worlds). The player can go trought the different frames and get differents objects like "coins". But I have a problem. When I start the game, the player is in frame 1. The player pick up a coin and it is destroyed. Now the player go trought a door to another world (Frame 2) and when the player return trought that door to the frame 1 again, the coin is there again. I tought that the function of a "Global object" was used for the thing i want to do, but it doesn´t work. So, is there a way to destroy an object forever and do not reapear if I go to the frame again?

    Thank you so much!

  • Are all the coins multiple instances of the same object, or are they different objects?

    Sent from my SM-T280 using Tapatalk

    Please login to see this link., Please login to see this link.
    Discord: Please login to see this link., Please login to see this link., Please login to see this link.

  • Admittedly i'm a bit rusty in Fusion but if you're using a global object i'd try setting an alterable variable or flag on the coin when it's picked up by the player and then, at the start of the frame, run through each coin and destroy every instance with said flag or value set

    [SIGPIC][/SIGPIC]

  • Yea, that was not a good suggestion since destroying the object will reset the flag. So i'm thinking instead of actually destroying the coin, you could use flags to set their visibility and position

    If a coin has been picked up, set it's flag on and move it outside the play area. That way it will appear to have been destroyed but you should be able to keep track of them using flags

    [SIGPIC][/SIGPIC]

  • Very dirty example of what i mean here

    There is probably a much more elegant way of doing this but as i said, i'm a bit rusty

    Anyway, it works but you need to have different names for the coin in each frame

    Please login to see this attachment.

    [SIGPIC][/SIGPIC]

  • Easiest way if you have multiple instances of the coin, is to spread value in an alterable value ID so the coins can be distinguished from one another. When you collect a coin, record the ID value in an array file, then destroy the coin. Save the Array when you leave the frame. Then when you come back to the level, at the start of frame spread the value again so the IDs are matched up to the coins again. Then use a fast loop to go through each row in the array and read the saved ID values, comparing the alterable value ID of the coin to the value in the array file. That will select the specific coin and you can destroy it.

    No need to worry about have multiple different coin types in your game.

    You can also use the Z-index of the array for separate levels so all of your save data can be contained in one array.


    Sent from my iPhone using Tapatalk

    Custom A* Pathfinding in MMF2: Please login to see this link.
    Random Tile World Generation: Please login to see this link.

  • ... Then use a fast loop to go through each row in the array and read the saved ID values, comparing the alterable value ID of the coin to the value in the array file. ...

    I'm curious how to do this part correctly with the Array object, Sumo.

    Can you update this example file later, please?

    (example has moved to my next post)

    Currently working on ... [SIGPIC][/SIGPIC] ... a Puzzle Platformer

    Edited 5 times, last by Wodjanoi (July 14, 2017 at 6:19 PM).

  • Yeah I'm at work now but I'll check it out later. I'll try to explain it in a bit more detail if you want to test it out.

    +Start of Frame
    -Start fastloop "load array" - number of loops is equal to the Y dimension of the array

    +On loop "load array"
    +Compare to coin alterable ID value = Retrieve data from array XY (X = 0, Y = fastloop "load array" index)
    - Destroy coin

    Assuming the array has a 0 based index. It's better this way since fastloops also have a 0 based index. Make sure to compare to the alterable value of the coin directly instead of using compare two general values. Compare two general values doesn't account for object scope.


    Sent from my iPhone using Tapatalk

    Custom A* Pathfinding in MMF2: Please login to see this link.
    Random Tile World Generation: Please login to see this link.

Participate now!

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