ROBOTICS
ICT 10
THIRD QUARTER
1. Motion Blocks
These blocks control the movement of sprites (characters or objects):
• Move [10] steps: Moves the sprite forward by the specified number
of steps.
• Turn [15] degrees: Rotates the sprite by the specified number of
degrees.
• Go to [mouse-pointer]: Moves the sprite to a specific position or to
the mouse pointer.
2. Looks Blocks
These blocks change the appearance of sprites:
• Say [Hello!] for [2] seconds: Makes the sprite display a speech
bubble with the specified text for a certain amount of time.
• Switch costume to [costume1]: Changes the sprite's appearance to a
different costume.
• Change [color] effect by [25]: Alters the visual effect of the sprite.
3. Sound Blocks
These blocks manage sounds:
• Play sound [meow] until done: Plays a sound effect until it finishes.
• Change volume by [10]: Adjusts the volume of the sound.
4. Event Blocks
These blocks are used to trigger scripts based on events:
• When [green flag] clicked: Starts the script when the green flag is
clicked.
• When this sprite clicked: Starts the script when the sprite is clicked.
5. Control Blocks
These blocks control the flow of the program:
• Wait [1] seconds: Pauses the script for a specified amount of time.
• Repeat [10]: Repeats the enclosed blocks a certain number of times.
• If <condition> then: Runs the enclosed blocks if the specified
condition is true.
6. Sensing Blocks
These blocks detect different aspects of the project:
• Touching [mouse-pointer]?: Checks if the sprite is touching the
mouse pointer.
• Key [space] pressed?: Checks if a specific key is pressed.
7. Operators Blocks
These blocks perform mathematical operations and logic:
• [2] + [3]: Adds two numbers.
• [5] > [3]: Checks if one value is greater than another.
8. Variables Blocks
These blocks are used to store and retrieve values:
• Set [variable] to [0]: Sets the value of a variable.
• Change [variable] by [1]: Changes the value of a variable by a
specified amount.
Different ways to animate your sprite:
1. Basic Motion Animation
• This involves moving your sprite across the screen. Here's a simple example:
• scratch
• when [green flag] clicked
• forever
• move [10] steps
• if on edge, bounce
• This script will make your sprite continuously move and bounce off the edges of the stage.
Different ways to animate your sprite:
2. Switching Costumes
• Sprites can have multiple costumes, which can be switched to create an animation effect. Here's an example:
• scratch
• when [green flag] clicked
• forever
• switch costume to [costume1]
• wait [0.1] seconds
• switch costume to [costume2]
• wait [0.1] seconds
• This will make your sprite switch between two costumes, creating a simple animation.
Different ways to animate your sprite:
3. Animating a Walking Sprite
• If you have a sprite with different costumes for each step of a walking cycle, you can create a walking animation:
• scratch
• when [green flag] clicked
• forever
• switch costume to [walking1]
• move [5] steps
• wait [0.1] seconds
• switch costume to [walking2]
• move [5] steps
• wait [0.1] seconds
This script will make your sprite appear to walk across the screen by switching between walking costumes.
Different ways to animate your sprite:
4. Animating with Key Presses
• You can also animate your sprite in response to key presses. For example, making a character walk when the arrow keys are pressed:
• scratch
• when [green flag] clicked
• forever
• if <key [right arrow] pressed?> then
• change x by [10]
• switch costume to [walking1]
• wait [0.1] seconds
• switch costume to [walking2]
• wait [0.1] seconds
This script will move the sprite to the right and switch costumes when the right arrow key is pressed.
Different ways to animate your sprite:
5. Smooth Animation with Glide
• To create smooth movement animations, you can use the glide block:
• scratch
• when [green flag] clicked
• glide [1] secs to x: [100] y: [100]
This will smoothly move the sprite to the specified coordinates over one second.
Different ways to animate your sprite:
6. Animating the Background
• You can also animate the background to create a more dynamic scene:
• scratch
• when [green flag] clicked
• forever
• next backdrop
• wait [2] seconds
This will switch the backdrop every two seconds, creating an animation effect.
Example: Simple Dance Animation
scratch
• when [green flag] clicked
• forever
• switch costume to [dance1]
• wait [0.2] seconds
• switch costume to [dance2]
• wait [0.2] seconds
• switch costume to [dance3]
• wait [0.2] seconds
• switch costume to [dance4]
• wait [0.2] seconds
Tips for Animating:
• Experiment: Try different blocks and combinations to see what works best for your animation.
• Timing: Use the wait block to control the speed of your animations.
• Costumes: Use multiple costumes for smoother animations. You can draw your own costumes in the
Scratch costume editor.
Basic Game Design Principles
1. Understanding Game Mechanics
• Definition and Purpose: Game mechanics are the rules and systems that define how a game works,
creating the structure and providing challenges for the player.
• Examples in Scratch: Common mechanics include sprite movement, scoring, levels, and win/loss
conditions.
• Implementation: Practice creating simple game mechanics using Scratch blocks.
Basic Game Design Principles
2. Creating Sprites and Backdrops
• Custom Sprites: Design and draw your own sprites using the costume editor. Make sure they are visually
appealing and fit the theme of your game.
• Backdrop Creation: Develop unique backdrops to set the scene for your game. The background can change
to indicate different levels or environments.
• Switching Costumes and Backdrops: Use blocks like switch costume to [costume] and switch backdrop to
[backdrop] to create dynamic visuals and transitions.
Basic Game Design Principles
3. Programming Movement and Controls
• Basic Movement: Use blocks like move [10] steps and turn [15] degrees to control sprite movement.
• Key Presses: Implement controls using key press events (e.g., arrow keys for movement).
• Smooth Movement: Use the glide block for smooth transitions and animations. This helps make the game
more visually appealing.
Basic Game Design Principles
4. Handling Events and Interactions
• Event Triggers: Understand how events like when [green flag] clicked and when [this sprite] clicked trigger
scripts.
• Interactions: Create interactions between sprites, such as collision detection (touching [sprite]).
• Broadcasting: Use broadcast messages to coordinate actions between multiple sprites, enhancing
interactivity.
Basic Game Design Principles
5. Scoring and Game Logic
• Variables: Introduce variables to keep track of scores, lives, and other game stats.
• Incrementing Scores: Implement scripts that update scores based on player actions.
• Game Over Conditions: Define conditions for winning or losing the game. Use blocks like stop [all] to end
the game.
Basic Game Design Principles
6. Designing Levels and Challenges
• Level Design: Plan and create different levels with increasing difficulty to keep the game engaging.
• Checkpoint and Progression: Implement checkpoints and save progress features to maintain player
interest.
• Balancing: Ensure the game is challenging but fair for players.
Basic Game Design Principles
7. Adding Sound and Effects
• Sound Integration: Add sound effects and background music to enhance the gaming experience.
• Visual Effects: Use graphic effects like change [color] effect by [25] to add visual flair.
• Timing and Synchronization: Synchronize sounds and effects with gameplay actions for a cohesive
experience.
Basic Game Design Principles
8. Testing and Debugging
• Playtesting: Test the game to identify and fix bugs and issues.
• Debugging Tools: Learn how to use Scratch’s debugging tools to troubleshoot problems.
• Feedback: Gather feedback from peers to improve the game.
Basic Game Design Principles
9. User Interface and Experience
• Menus and Instructions: Create start menus, instructions, and end screens to guide the player.
• Player Feedback: Implement features that provide feedback to players, such as score displays and health
bars.
• Usability: Ensure the game is easy to understand and play.
Basic Game Design Principles
10. Sharing and Presentation
• Project Sharing: Learn how to share your Scratch project online to reach a wider audience.
• Presentation Skills: Develop skills to present and explain your game to others effectively.
• Peer Review: Participate in peer reviews to get constructive feedback and improve your game.
THE DIFFERENT CODES IN SCRATCH IN CREATING A
PROJECT
Motion Blocks
• These blocks control the movement of sprites.
• Move Steps: Moves the sprite forward by a specified number of
steps.
• Turn Degrees: Rotates the sprite clockwise or counterclockwise.
• Go to (x: y:): Moves the sprite to a specific coordinate on the stage.
• Glide to (x: y:): Moves the sprite smoothly to a specified coordinate
over a set duration.
THE DIFFERENT CODES IN SCRATCH IN CREATING A
PROJECT
Looks Blocks
• These blocks change the appearance of sprites and the stage.
• Say/Think for Secs: Makes the sprite display a speech or thought
bubble for a specified duration.
• Switch Costume to: Changes the sprite's costume.
• Change Size by: Increases or decreases the sprite's size by a specified
amount.
• Show/Hide: Makes the sprite visible or invisible.
THE DIFFERENT CODES IN SCRATCH IN CREATING A
PROJECT
Sound Blocks
• These blocks control sound effects and music.
• Play Sound Until Done: Plays a sound file completely before moving
to the next block.
• Stop All Sounds: Stops all currently playing sounds.
• Change Volume by: Increases or decreases the volume by a specified
amount.
THE DIFFERENT CODES IN SCRATCH IN CREATING A
PROJECT
Events Blocks
• These blocks handle events that trigger scripts.
• When Green Flag Clicked: Starts the script when the green flag is
clicked.
• When Key Pressed: Starts the script when a specified key is pressed.
• When Sprite Clicked: Starts the script when the sprite is clicked.
THE DIFFERENT CODES IN SCRATCH IN CREATING A
PROJECT
Control Blocks
• These blocks control the flow of the program.
• Wait Secs: Pauses the script for a specified duration.
• Repeat (): Repeats the contained blocks a specified number of times.
• Forever: Repeats the contained blocks indefinitely.
• If Then: Executes the contained blocks if a specified condition is true.
THE DIFFERENT CODES IN SCRATCH IN CREATING A
PROJECT
Sensing Blocks
• These blocks detect various conditions and interactions.
• Touching (): Checks if the sprite is touching a specified object.
• Key () Pressed: Checks if a specified key is pressed.
• Mouse X and Y: Returns the X and Y coordinates of the mouse
pointer.
THE DIFFERENT CODES IN SCRATCH IN CREATING A
PROJECT
Operators Blocks
• These blocks perform mathematical operations and comparisons.
• (): Addition, Subtraction, Multiplication, Division: Performs basic
arithmetic operations.
• (): And, Or, Not: Performs logical operations.
• (): Greater Than, Less Than, Equal To: Compares two values.
THE DIFFERENT CODES IN SCRATCH IN CREATING A
PROJECT
Variables Blocks
• These blocks manage variables and lists.
• Set to (): Sets a variable to a specified value.
• Change by (): Changes a variable by a specified amount.
• Show Variable: Makes a variable's value visible on the stage.
THE DIFFERENT CODES IN SCRATCH IN CREATING A
PROJECT
My Blocks
• These blocks allow you to create custom blocks for specific functions.
• Define (): Defines a custom block with specified parameters.
• Call (Custom Block): Executes the custom block with specified inputs.
THANK YOU!