Uploaded by Sheetal Chawla

Scratch Tutorial: Learn to Code with Scratch

advertisement
Step 1: Understanding the Scratch Interface
📌 Go to https://scratch.mit.edu/ and click on "Create."​
📌 The main parts of Scratch are:​
1️⃣ Stage – Where animations happen.​
2️⃣ Sprites – Characters and objects.​
3️⃣ Blocks Palette – Drag-and-drop code blocks here.​
4️⃣ Scripting Area – Where you build your program.
📝 Practice:
●​ Click on the cat (default sprite) and rename it.
●​ Click on the Backdrops tab and change the background.
Step 2: Moving a Sprite (Basic Motion)
📌 Goal: Make the sprite move when you click the green flag.
Steps:
1️⃣ Drag "when green flag clicked" from Events.​
2️⃣ Drag "move 10 steps" from Motion and attach it below.​
3️⃣ Click the green flag (top right) to test.
📝 Practice:
●​ Change 10 steps to 50 steps.
●​ Try “turn 15 degrees” to rotate the sprite.
Step 3: Making a Sprite Move with Keyboard
📌 Goal: Move the sprite using arrow keys.
Steps:
1️⃣ Drag "when right arrow key pressed" from Events.​
2️⃣ Add "move 10 steps" from Motion.​
3️⃣ Duplicate the code and change:
●​ Left Arrow: "move -10 steps"
●​ Up Arrow: "change y by 10"
●​ Down Arrow: "change y by -10"
📝 Practice:
●​ Try making a car or an animal move using arrow keys.
Step 4: Adding Loops (Repeat Actions)
📌 Goal: Make the sprite move continuously.
Steps:
1️⃣ Drag "when green flag clicked" from Events.​
2️⃣ Drag "forever" from Control.​
3️⃣ Inside "forever," place "move 10 steps".​
4️⃣ Add "if on edge, bounce" from Motion.
📝 Practice:
●​ Adjust speed by changing "move 10 steps" to 5 or 20 steps.
●​ Try “repeat 10 times” instead of "forever."
Step 5: Adding Sounds
📌 Goal: Make the sprite talk or play sounds.
Steps:
1️⃣ Click Sounds tab and choose a sound.​
2️⃣ Drag "when green flag clicked" from Events.​
3️⃣ Add "play sound until done" from Sound.
📝 Practice:
●​ Make a cat meow when clicked.
●​ Change sprite’s speech bubble using "say Hello!" block from Looks.
Step 6: Sensing & Interaction
📌 Goal: Make the sprite react when touching another object.
Steps:
🍎
1️⃣ Add another sprite (e.g., an apple
).​
2️⃣ Drag "when green flag clicked" from Events.​
3️⃣ Add "forever" from Control.​
4️⃣ Inside "forever," add "if touching Apple?" from Sensing.​
5️⃣ Inside "if," add "say I found an apple!" from Looks.
📝 Practice:
●​ Change it to hide the apple when touched.
●​ Add a score counter using a variable (explained in Step 8).
Step 7: Creating a Simple Game
📌 Goal: Make a sprite collect items (e.g., a cat catching fish 🐟).
Steps:
1️⃣ Create two sprites: a cat & a fish.​
2️⃣ Program the cat to move using arrow keys.​
3️⃣ Add code to hide the fish when touched by the cat.​
4️⃣ Add a sound effect when the fish is collected.
📝 Practice:
●​ Make the fish reappear in a random position.
●​ Add a timer to complete the challenge.
Step 8: Using Variables (Score System)
📌 Goal: Keep track of the player’s score.
Steps:
1️⃣ Click "Variables" → Make a Variable → Name it "Score".​
2️⃣ Drag "set Score to 0" under "when green flag clicked".​
3️⃣ Inside "if touching fish?" add:
●​ "change Score by 1"
●​ "hide fish"​
4️⃣ Test the game. The score should increase when collecting the fish.
📝 Practice:
●​ Add a win message when the score reaches 5.
●​ Try changing the background when the player wins.
Step 9: Broadcast Messages (Advanced)
📌 Goal: Change backgrounds when the game starts or ends.
Steps:
1️⃣ Drag "when green flag clicked".​
2️⃣ Add "broadcast Start" from Events.​
3️⃣ Under "Backdrops," add "when I receive Start → switch backdrop".​
4️⃣ Add another message "Game Over" when the score reaches 5.
📝 Practice:
●​ Add a “Try Again” button when the game is over.
Step 10: Final Project – Choose Your Own Game!
📌 Goal: Create your own Scratch project using everything you've learned!
Ideas:
✔️ Maze Game – Move a character to reach the goal.​
✔️ Catch Game – Collect items within a time limit.​
✔️ Story Animation – Make characters talk and interact.
Download