Which Button?

{Introduction }

The Info category has a number of properties that help handle common behaviors in games. By default, these properties show up on screen as soon as they are set, allowing for an easy way to give the people playing your game information about how well they are doing.

{Step 1 }

Find set score to 0 in Info, and drag it into on start.

This will set the initial score of the game to 0; notice how the score now appears in the top right corner of the screen.

0set score toon start

{Step 2 }

Find set life to 3 in Info, and drag it into on start. Change the 3 to 5.

This sets the amount of lives a player will start with. Lives show up in the top left corner of the screen, and if the player runs out of lives the game will end.

05set life toset score toon start

{Step 3 }

Find start countdown 10 (s) in Info, and drag it into on start.

This will start a countdown of 10 seconds, after which the game is over. This also places a large timer at the top of the screen, so that the player knows they need to rush.

0510start countdown(s)set life toset score toon start

{Step 4 }

Find on A button pressed in Controller, and drag it into the workspace.

onAbuttonpressed0510start countdown(s)set life toset score toon start

{Step 5 }

Find change score by 1 in Info, and drag it into on A button pressed.

This will make it so that whenever the A button is pressed, the player’s score will increase by one. Try pressing the button multiple times, and see how high you can get the score.

1change score byonAbuttonpressed0510start countdown(s)set life toset score toon start

{Step 6 }

Get another on A button pressed, and drag it into the workspace. Change A to B.

1change score byonAbuttonpressedonBbuttonpressed0510start countdown(s)set life toset score toon start

{Step 7 }

Find change life by -1 in Info, and drag it into on B button pressed.

This will make it so the player will lose life when they press the B button. Try to press it multiple times, and see how the life is displayed as it goes down to 0.

1change score byonAbuttonpressed-1change life byonBbuttonpressed0510start countdown(s)set life toset score toon start

{Complete }

Congratulations, you have completed your game! This one may be simple - with the only way to lose life being to press the wrong button - but the blocks can be combined with others, like sprite overlap events, to make games where players are rewarded or punished based on their performance.