Assemble3

Wiki

Text and score

The Text object draws letters on screen: score, lives, time, messages.

Show the score

  1. Create a global variable Score (see Variables).
  2. Under Add object, create a Text object called ScoreText. Put it in the layout, on an interface layer that does not move with the camera.
  3. In an event that runs every frame, change the text:
Conditions Actions
(none) ScoreText Change the text to "Score: " + ToString(Score)

The change-text action is in the ScoreText object's list. In text fields, fixed text goes between quotes. ToString turns the variable's number into text so it can be joined to the rest.

Putting it together

Conditions Actions
Player Collision with Coin Coin Delete
Change variable value Score + 1
(none) ScoreText Change the text to "Score: " + ToString(Score)

Show lives

The same: a Lives variable, a LivesText object and the expression "Lives: " + ToString(Lives).

Changing the look

In the Text object's Properties you choose the font, size and colour. To use your own font, add the file under Project files.

Victory and defeat

Conditions Actions
Variable value Score >= 10 Change layout to Victory
Variable value Lives <= 0 Change layout to GameOver

See Multiple layouts.