#1.1 Loot: Batteries



Batteries are the currency of this small prototype. The player can collect them and automatically gets one life exchanged for ten of them. But in order to do that, you have to pick them up first.  And it works like this: 


If the player touches the battery, the variable $Player_Battery is increased by one. Then the battery flies up to activate the item pickup. Afterwards the actor is hidden. Finally, the $Coin_used variable ensures that the same battery cannot be picked up multiple times. After the recording it is incremented by one. But the Actor script is only executed if $Coin_used == 0. This is taken care of by the If loop, which encloses the whole script.

If the scene has to be reloaded after the player has died, the variable $Reset_scene is set to 1. This resets the local $coin_used variable in the battery's On Init script to 0 so that the player can resume it in the new run.

This reset is necessary for ALL objects and enemies that the player interacts with in any way.

Get GB Space Jump -2.0

Leave a comment

Log in with itch.io to leave a comment.