Randomising the behaviour of Sprites Games Programming in Scratch Games Programming in Scratch L4 Randomising the behaviour of Sprites STARTER Your game is developing nicely… but what could you add to it to make it… • Realistic • Interesting • Fun • Different each time ? Games Programming in Scratch L4 Randomising the behaviour of Sprites Learning Objectives: o Use the Pick Random block to position objects randomly on the screen o 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 Games Programming in Scratch L4 Randomising the behaviour of Sprites 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! Games Programming in Scratch L4 Randomising the behaviour of Sprites 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 Games Programming in Scratch L4 Randomising the behaviour of Sprites The Scratch window • The Scratch window has coordinates • Where is 0,0? 180 y -240 240 x -180 Games Programming in Scratch L4 Randomising the behaviour of Sprites 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) Games Programming in Scratch L4 Randomising the behaviour of Sprites 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: 1. Try to solve the problem yourself 2. Use the help files and tutorials 3. Look at the Scratch Community projects for tips 4. Use the Internet 5. Ask a friend 6. Ask the teacher Games Programming in Scratch L4 Randomising the behaviour of Sprites 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!) Games Programming in Scratch L4 Randomising the behaviour of Sprites 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… Games Programming in Scratch L4 Randomising the behaviour of Sprites Comment your Code Add comments to explain the blocks, particularly any ‘random’ actions used in your new ‘item to collect’
© Copyright 2026 Paperzz