This page or section is in question as to whether it is useful or not. You can discuss whether you think it should be deleted or not on its talk page. (August 2021) Reason: too small and easy of a topic to make a whole article on. |
This article is a stub. It may be incomplete, unfinished, or have missing parts/sections. If the article can be expanded, please do so! There may be suggestions on its talk page. (August 2021) |
This tutorial shows how to keep score in a game. First, make a variable named "score". How the game works defines which find of script should be used.
Color Sensing
If it is wanted to increase the score when a sprite touching a particular color, use a code string like this:
when gf clicked forever if <touching color [#FFFFFF]?> then change [score v] by (1) end
If it is wanted to decrease the score when touching a particular color, use the code string above, but change
change [score v] by (1)
to
change [score v] by (-1)
.
Sprite Sensing
To sense when a sprite touching another sprite, replace <touching color [#FFFFFF]?>
with <touching (sprite v)?>
.
Click Sensing
To sense if a sprite is clicked, use:
when this sprite clicked change [points v] by (...::grey)
or
when gf clicked forever if <<touching (Sprite v)?> and <mouse down?>> then change [points v] by (...::grey)
Broadcasts
To use broadcasts, use
when I receive [increase score v] change [score v] by (1) when I receive [decrease score v] change [score v] by (-1)