50 likes | 130 Views
Learn how to program a cat to catch a mouse in a step-by-step guide using code blocks and events. Have fun while mastering basic coding concepts for beginners. Follow along to create an interactive animation.
E N D
Handle the event of „catch”(1/5) • We are going to program the cat to catch the mouse • Select the cat sprite first to program • Add „if” with condition „touching” • Select touching object from the list
Handle the event of „catch”(2/5) • Add „broadcast …” to send an event message to all other objects • Add „play sound …” to hear sound • Add „say …” to get written message on the screen
Handle the event of „catch”(3/5) • Embed „if” into a „forever” function • Press on the green flag
Handle the event of „catch”(4/5) • We now program the mouse • Select the mouse sprite to get its script • Add „when I receive …” function and select „catchYou” message
Handle the event of „catch”(5/5) • When the mouse gets the event message then this program block runs • Use „hide” to clear mouse sprite from the screen and „wait” for waiting for the new stage background • Use „go to …” function to the new starting position of mouse spirit • Use „show” function to get mouse sprite • Press on the green flag and see what happens