How to prevent player from collecting coins 2 times?

How do I make sure that when a player repeats a completed stage, the coins from that stage that have already been collected no longer appear?

Somehow you need a game_level_variable . like gs_game_level = 1

Add an object variable to the coin like
obj_var_coin_number = 0
In a foreach or when you create the coins add obj_var_coin_number = 1, or obj_var_coin_number =2 and so on.

Begin of the scene
Condition: Foreach Coin
Condition: “coin_”+VariableString(gs_game_level )+""+Coin.Variable(obj_var_coin_number )+“collected" exists
Action: Read "coin
”+VariableString(gs_game_level )+"
"+Coin.Variable(obj_var_coin_number )+"_collected" and store value in gs_coin_collected
In a sub event inside the foreach
Condition: gs_coin_collected = 1
Action: Delete Coin

To collect a coin:
Add Trigger Once when the player collides with the coin
Write 1 in “coin_”+VariableString(gs_game_level )+"_"+Coin.Variable(obj_var_coin_number )+"_collected"

Forget about all i brote is better with caps.
Begin of the scene


A sub event inside begin of the scene

A collision player coin event

Proof of concept

1 Like