Download presentation
Presentation is loading. Please wait.
1
Randomising the behaviour of Sprites
Games Programming in Scratch
2
STARTER Your game is developing nicely… but what could you add to it to make it… Realistic Interesting Fun Different each time ?
3
Today’s Lesson Learning Objectives:
Use the Pick Random block to position objects randomly on the screen Understand the use of the operators <, =, >, and, or, not and use them in my game where needed Excellence I can make use of ‘randomising’ within another feature of my own design in my game Developing I can use ‘randomising’ to change Sprite positions and experiment with the script to change movement Secure I can use ‘randomizing’ in my game to change positions of Spites on screen and describe basically how the script works Foundation I can with support add ‘randomising’ of sprites in my game
4
Working with Operators
You have already used some operators with variables (e.g. Lives = 0) But lots more available that can be used to make your game better / more interesting / fun!
5
Where to use Randomisation
You can combine the use of operators, sprites, and coordinates to make objects appear at various points on the screen randomly. For example, this might be useful if: You died and wanted to come back to a specific location and use another life Enemies that have been killed return Collectable treasures appear on screen randomly Work out how to make objects appear randomly on screen
6
The Scratch window The Scratch window has coordinates Where is 0,0?
x y 240 -240 -180 180
7
Using randomisation One possible use!...
Make sprites appear at random locations using the Show and Hide blocks But you could use the ‘pick random’ number action with many other different examples! (which we will explore)
8
Getting stuck Getting stuck is all part of programming. It is learning how to find a solution that really matters. Remember, if you are stuck: Try to solve the problem yourself Use the help files and tutorials Look at the Scratch Community projects for tips Use the Internet Ask a friend Ask the teacher
9
Add another object to collect
Today’s Task 1a Add another object to collect Think about your game, then Find, Save, and Import (or get it from gallery) another object to collect in your game Now add the following events to your new object to collect (similar to your other object so far!)
10
Making the new object to collect ‘RaNdOm!’
Today’s Task 1b Making the new object to collect ‘RaNdOm!’ Now to make the new object behaviour more ‘randomly’ using our new blocks. Add this script to your new item… It will make it go to a random place on the screen! But now, your challenge is to make it more random again! Lots to choose from, experiment with some of these…
11
Comment your Code Today’s Task 2
Add comments to explain the blocks, particularly any ‘random’ actions used in your new ‘item to collect’
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.