Download presentation
Presentation is loading. Please wait.
1
(More) Basic blocks Broadcasting messages
Lesson 2 (More) Basic blocks Broadcasting messages
2
Recall… The blocks you’ve learnt in the last lesson: Event blocks
Motion block Look blocks Sound blocks
3
Basic blocks Motion block – point towards Control blocks
Sprite pointing towards an object. Control blocks FOREVER: The command inside this block will be done forever. IF: If (something) is correct, then do the followings.
4
Basic blocks Sensing block Looks block Touching something
Change backdrop
5
Broadcasting messages
One sprite broadcasts a message The other (same) sprite will do the commands after receiving the broadcasted message (e.g. message1).
6
Exercise 2 Your task: The “Dog” sprite moves “like walking” towards the “Cat” sprite. (Hint: use FOREVER. Choose an appropriate speed(steps).) Set the starting position of the Dog (initialization). The “Dog” barks (once) when touching the “Cat”. (Hint: use IF)
7
Exercise 2 The backdrop of the stage changes when the “Dog” touches the “Cat”. (Use broadcast) The cat ‘meow’s back after the dog barks. Play background music of your own choice.
8
Exercise 2 Bonus feature:
Create a pause/play button so that you can pause/play when clicked. Hint: Pause/play are like on/off. You may need E.g. (odd no) mod 2 =1 (even no) mod 2 =0
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.