Moving and Sensing

The children should already have a good sense of how to move a sprite around the screen from the session on turtle graphics. Note that turtle graphics move the sprite relative to its current position and is a much simpler system to introduce to children than placing an object on a grid with X and Y co-ordinates. Scratch supports both approaches but we recommend that younger children stick to the relative movements and repeat turns of 30 degrees rather than learn the coordinates on a grid and angles. By all means use these features in Scratch if the children are already familiar with these concepts.

One exception is the initial commands which are executed when you press the green start flag in Scratch to start (or restart) the project. We introduce the GOTO command here to initialise the sprite in a start position to reset the application.

Sensing allows the sprite to follow the mouse or another sprite and recognise when a collision occurs. The forever loop is introduced to get a sprite to follow the mouse around the screen and keyboard events are introduced, along with a second sprite, to move the sprite in reaction to keyboard events such as pressing the arrow keys. This forms the basis of a two player game written in Scratch and children can substitute their own sprites, related to their favourite TV characters or to a topic covered in class, making an excellent base for a final project.

Please take a look at the video for moving with the arrow keys and the second video on moving with the mouse.

19/03/2024 07:59:38