Game Development Reference
In-Depth Information
The player will be able to steer left and right with the keyboard keys:
1. Get two key () pressed blocks and place them next to each other.
2. Select the d key for one block.
3. Underneath it, atach a turn <clockwise> () degrees block; fill in the value 6 .
4. Select the a key for the other block.
5. Atach a turn <counterclockwise> () degrees block to it; fill in the value 6 .
The following screenshot shows the final script:
That's all you need to do to make the control sprite turn left and right. Now, we need to
atach the kart sprite, so we can actually see where the control sprite is going:
1. Drag-and-drop both key control scripts onto the kart sprite to copy them there.
2. Click on the kart sprite to see its Scripts view.
3. Before we go on with the scripts, we need to change a sprite property, so we press
the i icon on the sprite.
4. We change the rotaion style to no rotaion; this opion is shown as a blue dot.
5. This makes sure the sprite isn't responding directly to our rotaion input. Instead of
actually rotaing the sprite, we are going to change its costume to correspond with
the current angle.
6. Next to the key control scripts, start a new script with when <green lag> clicked .
7. Atach the Set size to () % block and fill in 50 .
8. Now add the point in direcion () block with value 0 or up. This synchronizes the
kart sprite direcion with the control sprite direcion.
9. Add a forever loop.
10. Make the kart sprite go to player1 using go to <player1> . As long as the loop runs,
the kart sprite will follow the control sprite around.
 
Search WWH ::




Custom Search