How can I prevent the player from obtaining an item twice after respawning at a checkpoint?

I’m making a kind of platform game I guess, and I managed to make a system where the player can obtain collectibles to increase their score, and this score is maintained when they respawn if they reached a checkpoint after obtaining the collectible, as well as between levels. I’m doing this using a save function on 4.23. However, it’s all too easy to just keep obtaining the collectible, then reaching a checkpoint, then dying to respawn and collecting it again. Obviously this results in a potentially infinite score for very little work. I’d like to be able to prevent the collectible from respawning if it has already been collected without removing the ability to go back and get it if the player missed it.

Any help would be appreciated :slight_smile:

Hi man,
You have to “Spawn collectible” only 1 time,
when it isccollected by the player you have to say to a variable that this collectable must not be spawned again.

For Example you have to:
set an array of booleans, or better stuff…
You start the game with all booleans set to 0,
when the player collect an item, you have to set the corrisponding boolean to 1, so you can keep track of wich item spawn.
When saving the game, save this too in to a savegame
So when the game start, you load the file and check
If some of the boolean are 1, then dont spawn that item, or delete that item from the level.

Why not save the score at the end of a level?