Game Development Reference
In-Depth Information
Horizontal movement
For movement, we will create two more blocks using More Blocks , one for the horizontal
movement and another for the verical movement. The More Blocks feature lets the users
group the commonly used codes in custom blocks, making the code shorter and easier
to read. In terms of computer programming languages, More Blocks are like methods
or funcions. Each More Block can have zero or several input parameters. Similar to the
variables in a mathemaical funcion, input parameters are plugged into More Blocks to
produce the desired result. For example, one can have a More Block named Jump that will
jump num_jump imes, num_jump being the input parameter. At runime, if num_jump holds
a concrete value such as 3 , then the Jump block would jump three imes. For horizontal
movement, we are going to create a More Block named Move Horizontally , which when
executed, would move the Spaceship horizontally, as shown in the following screenshot:
To create code for horizontal movement, perform the following steps:
1.
Select the More Blocks tab and click on the Make a Block buton.
 
Search WWH ::




Custom Search