Game Development Reference
In-Depth Information
The script should look like the following screenshot:
Lastly, we need to set the lap variables to their staring values when the game starts.
Place a set <lap> to () block at the start of the when <green lag> clicked script; fill in the
value -1 . Do this for both control sprites.
We use -1 and not 0 because the karts will drive over the finish line as soon as they start
racing, acivaing the script we just wrote and increasing the lap number. So we can explain
-1 as "the race has not started yet" and 0 as "the race has begun, but no lap has been
completed yet".
Objective complete - mini debriefing
That completes our kart racing game. Two players can now compete against each other to
race three laps in record ime. Gather some friends and have a racing compeiion. Playing
against the computer is good entertainment, but playing with friends and family is even
more enjoyable. You can also show off your hard work!
Classified intel
You may have noiced that we keep switching the value of the touchFinish variable with
an if () else statement. You can compare it with flipping a light switch. This is a special kind
of variable called Boolean . It only has two meaningful numbers. It can be either 0 (of) or 1
(on). Any other numbers will be counted as 1 .
 
Search WWH ::




Custom Search