Game Development Reference
In-Depth Information
When the kart drives through sand, we will slow it down. We do this by muliplying its
current speed with a number smaller than 1 using these following steps:
1. Place a () * () operator block in the vacant slot.
2. Fill the left slot of the operator with the speed1 variable.
3. Type in 0.8 in the right slot of the operator.
4. To add the instrucions for hiing the borders, copy the enire if () then statement
and atach it to the original.
Change the color to check for the green color that you used on the collision mask.
When hiing the border, the kart should bounce back. We do this by muliplying the speed
with a negaive number:
1. Change 0.8 to -0.6 .
2. Grab the enire script and drag it to the exising when <green lag> clicked script.
Place it between the if () then statement that checks for maximum speed and the
move instrucion.
This is all that you need to do for the bouncing-off-walls effect.
Objective complete - mini debriefing
Test the script and see how the kart responds to hiing the sandbox or the walls. It will
no longer be possible to drive carefree across the stage. If you leave the road, the kart
will come to a grinding halt giving your opponent an advantage.
Search WWH ::

Custom Search