Scratch Programming Session 1 PDF
Document Details
Uploaded by DeadOnOwl1888
Tags
Summary
This document describes Scratch programming concepts, including broadcasts and clones, and provides an example related to a defense game, useful for beginners or primary school-aged children.
Full Transcript
Scratch Session 1 01. Broadcasts A broadcast is a message sent from one sprite to another, activating scripts with matching hat blocks. Broadcasts in Scratch are blocks that come under the “Events” block category. These blocks are yellow and available on the left side of the...
Scratch Session 1 01. Broadcasts A broadcast is a message sent from one sprite to another, activating scripts with matching hat blocks. Broadcasts in Scratch are blocks that come under the “Events” block category. These blocks are yellow and available on the left side of the scratch console. What are Broadcasts used for in Scratch coding? 1. Hold a Conversation: Broadcasting can prompt a character to answer a question or chat with another sprite. They can also share information. 2. Respond to Events: Use broadcasting to make a sprite react to an event. For example, a character may move when you press an arrow key. 3. Broadcast to Many Sprites: Broadcasting can send a message to many sprites. This can cause several characters to do something at the same time. Like on a click of a button, all the sprites start moving or dancing around. 4. End a Game: Use broadcasting to inform a player that the game has ended. For instance, you could display a message like GAME OVER/ YOU WIN/ YOU LOSE. This block starts a script of block when it receives a specific broadcast message. This block sends a broadcast message. This block sends a broadcast message and waits to continue running the scripts until other sprites run the scripts waiting for the broadcast messages. After these run, the scripts continue Lets get an example What does that mean? When you click on the cat each and every time the bat will get the message and move 10 steps. Your turn 02. CLONES Cloning is a feature that enables you to create multiples of as many sprites as you’d like while the project is running. When each clone is produced, it has the same costumes, sounds, scripts, and variables as the original but is otherwise When a clone is created, it starts running the code attached to this block. This block creates an identical version of your selected sprite each time you click on it. To reveal your clone, simply drag it away from the original as many times as you’d like. This block deletes the clone it’s running and stops all of its scripts. This block can be particularly useful for sprites you want to disappear, like bubbles, magic tricks, and more. Project time As a talented programmer, your task is to create this defense game. The game revolves around the following main elements: 1. Earth: Positioned at the center of the game, the Earth is the object that must be defended. 2. Ladybug Fighter: This is the hero of the game. The player can control the direction of the fighter using the mouse pointer. By pressing the space key, the fighter will create a clone that moves towards the mouse pointer, attacking and destroying the evil ladybugs. 3. Evil Ladybugs: These enemies spawn randomly around the Earth and slowly move towards it. If an evil ladybug reaches the Earth, one life is lost. The player starts with 10 lives. Each time an evil ladybug touches the Earth, the lives decrease by one. The game ends with a