Page 20 - Evolve Spring 2021 Magazine
P. 20

 Scratch tutorial
On this page I shall show you how to create a simple jumping game within the children-friendly scratch programming language. This can be acessed through: https://scratch.mit.edu
1.
First, we shall begin with your controllable sprite. Scratch starts you off with a cat from the get go, but you can change it yourself by clicking this button on the bottom right
This allows you to position the sprite appropriately to the background.
     5. Next you will have to implement another sprite that as you play the game will move towards you.
As seen in the image
opposite, when the flag
is clicked the secondary,
non-controllable sprite
will move towards you.
The forever command
lets the sprite to
continuously come back
into frame, while the “glide “ command and “go to” allows the sprite to move towards your controllable sprite.
This set of commands allows
you to give your controllable
sprite a health point system.
The “wait until” tells the
non-controllable sprite to wait
until it hits the “cat” (the controllable sprite) where it will then “stop all”, in the sense that the game will be over and you’ll have to start over.
     2. Afterwards you’ll want to have a background, this can be found on the bottom right under this button:
   3. First you will want to get your sprite to move, this is done by using the repeat command under the ‘Control’ tab. After that you want to embed the “change y by” in each repeat command. the “change y by” controls the movement on the y axis (vertically), so this would make the character jump. The “-10” will bring the character back to its original jumping position:
   6.Now returning back to the controllable sprite (the cat), you now need to add a point system and a return system. The return system is done through the command “go to x:” which will return the cat to the original position you placed it when beginning the game. The point is done through the “set Score to” and “change Score by” commands, this allows Scratch to recognise
that each time your controllable sprite passes a non-controllable one, a point is added up to your tally.
  4.After this you then want to attribute a key to the execution of the code (the jump). For this situation I have attributed the spacebar to “repeat” functions. This means when spacebar is pressed the sprite will jump 10 pixels up.
This allows the sprite to give off a sound when the spacebar has been pressed. This can be found in the “sound” tab
  20







































































   18   19   20   21   22