Game Development Reference
In-Depth Information
8.
Inside the forever block, add the set x to curr_scroll_amount + ( my_grid_idx *
grid_length ) block.
9.
Under the set x to curr_scroll_amount + ( my_grid_idx * grid_length ) block from step
6, add an if (<abs> of x posiion) > () then block; enter 350 . Then, enable the hide else
show block. The <abs> of x posiion > () block is a mathemaical method that returns
the absolute value of its input. You can try to use numbers other than 350 , especially if
you wish to create new brick costumes. This value should be between 240 (half of the
stage or a grid) and 480 . If this value is set too high, you will find that the sprites are
"stuck" to the edge of the Stage and follow the player while scrolling. If this value is set
too small, then the sprites would disappear suddenly.
Perform the following steps to create code to scroll automaically:
1.
Start with a when I receive <start_scrolling> block.
2.
Inside the when I receive <start_scrolling> block, add a forever block.
3.
Enter -1 in the change <curr_scroll_amount> by (() * scroll_speed) block, and
check whether the current scrolling amount is greater than the maximum scrolling
amount using the if (<abs> of curr_scroll_amount > max_scroll_amount) block.
When the maximum scrolling amount is reached, the player has reached the
edge of the grids. If so, then broadcast the broadcast <scroll_max_reached> block.
 
Search WWH ::




Custom Search