Page 34 - Touchcode_C7_Flipbook
P. 34
Step 15: Click on the arrow of ‘set mySprite2’ block, and select food.
Step 16: From the Sprite, select ‘on sprite overlaps otherSprite’.
Step 17: In the ‘on sprite overlaps otherSprite’ block, click on the second Player kind after
otherSprite to open the menu and select food.
Step 18: You will see that the player overlaps the apple.
Step 19: Now let’s add a point to our game score. From the ‘Info’, select the ‘change score’ block,
and move ‘Change score’ block to ‘on sprite of kind Player’ block.
Step 20: Now, you will set the position for apple to random location on the screen. Select ‘set
mySprite position’ from Sprite, block and place it in ‘on sprite overlaps otherSprite’ block
below ‘change score by 1’ block.
Step 21: In ‘set mySprite position to x, y’ of ‘on sprite of kind player’ block, click on ‘mySprite’ and
select ‘mySprite2’.
Step 22: From ‘Math’, select two ‘pick random’ blocks.
Step 23: Drop one ‘pick random’ block to x coordinate of the ‘set mySprite2’ and other to
y coordinate.
Step 24: The arcade game screen is 160 pixels wide and 120 pixels high. So, change the value of
10 to 160 in x; and from 10 to 120 in y.
32 Touchcode-VII

