Game Development Reference
In-Depth Information
Perform the following steps to create code to iniialize a clone's look and locaion:
1. Start with a when I start as a clone block.
2. Set my locaion in the grid to 0 using the set my_loc_in_grid to () block; enter 0 .
3. Next, set my start locaion in grids by using the set my_start_loc_in_grids to
(my_loc_in_grid+my_grid_idx*grid_length) .
4.
Set my grid index to the new grid index using the set <my_grid_idx>
to new_grid_idx block.
5.
Add the switch costume to ( (my_grid_idx + ()) - my_grid_idx) block; enter 1 .
We add 1 to my_grid_idx because the Scratch costume number starts at index 1
but the grid index starts at 0 .
6.
Then, enable the go to x: my_start_loc_in_grids y: plaform_y_value
and show blocks.
7.
Next, add a forever block.
 
Search WWH ::




Custom Search