Restart Scene Glitch
-
@SplitMindGaming yup just tested it out again with a simple interface. I have it save some coins. It was suppose to load it right on startup but with refresh on it doesnt do that.
-
@SplitMindGaming Just made a test project and it works fine, your behaviours must be wrong.
-
@Kamdroid would u mind sharing that test file. I want to see where i went wrong. Because i cannot load and save from a refresh scene for some reason.
-
@SplitMindGaming Here, open in Safari:
CoinSave.tap -
@Kamdroid ohh i see what i did wrong now. Thank you for that.
-
All logic is in the player.
Also supports having custom coin worth values for each individual coin.
-
@Kamdroid yes i seen you used dynamic. Its very smart.
-
@Kamdroid hey with the file you provided. How would you set it up so once it collects and adds 1 of the coins to the score. The next time it loads it will ignore that one certain coin and not add it to the score?
-
@SplitMindGaming Ignores the coins how?
Do you want any coins already collected to not show up on scene restart?
Or to still be visible, but not effect the score when collided with?
-
Personally, since we have object referencing (object IDs)
I'd store every coin ID the player collided with, in an array.
When colliding with a coin, I'd check if that coins ID is already saved in the coin collided array,
However, I remembered hyperPad doesn't even have an if array coins option (as far as I know). Previously I've used a loop to check all elements, but this has pretty bad performance. Ask @Hamed or @Murtaza
So I would just loop the array at the start, delete or set some attribute to "collected" of the coin object.
Or you could even try using a dictionary which lets you enter a key (the object ID), pretty sure it returns null key doesn't exist, so that can be like a workaround if contains.
-
@Kamdroid Thanks for that. Do you know if you can save to file a collision? So the next time the game starts it will load that collision then you can simply give it an ignore collision with that certain object? Or maybe even something similar.
-
The collided behaviour gives 2 outputs. Object A ID and object B ID
Object B would be the coin you collided with
Use modify array behaviour to append object B ID to an array (get coinsArray attribute).
Save that array to file and change coinsArray attribute to the array as well (set coinsArray attribute)
At the start, load collide array from save file and loop the array.
Use get array item with index "loop index"
That will be the coin ID. Set an attribute to tell it's already been collected, change the color, etc.