How to Keep Score in a Game

Материал из Поле цифровой дидактики
Описание Как хранить результаты (очки) в игре
Область знаний Информатика
Область использования (ISTE) Computational Thinker
Возрастная категория 7


Поясняющее видео
Близкие рецепту понятия
Среды и средства для приготовления рецепта: Scratch, Snap!, Lua

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 needed to detect when a sprite touching a particular color, use

whenclickedforeveriftouchingcolor?thenchangescoreby1endend

If it is wanted to decrease the score when touching a color, change changescoreby1 to changescoreby-1.

Sprite Sensing

To sense when a sprite touching another sprite, replace touchingcolor? with touchingsprite?.

Click Sensing

To sense if a sprite is clicked, use:

whenthisspriteclickedchangepointsby...

or

whenclickedforeveriftouchingSprite?andmousedown?thenchangepointsby...

Broadcasts

To use broadcasts, use

whenIreceiveincreasescorechangescoreby1whenIreceivedecreasescorechangescoreby-1