Introducing
Your new presentation assistant.
Refine, enhance, and tailor your content, source relevant images, and edit visuals quicker than ever before.
Trending searches
x is the horizontal position and y is the vertical position.
If you increase the x value the sprite will move to the right - if you decrease the x value the sprite will move to the left.
If you increase the y value the sprite will move up the screen - if you decrease the y value the sprite will move down the screen.
The red fish is at x: -100 y: 100
The yellow fish is at x: 100 y: 100
The blue fish is at x: -100 y: -100
The green fish is at x: 100 y: -100
Sprite 1 - "Doctor."
Sprite 2 - "Who's there?"
Sprite 1 - "How did you know?"
Sprite 1 - "Knock knock."
Sprite 2 - "Doctor who?"
The script on the left will make the bat flap its wings as it moves.
For an animation the bat needs to keep flapping its wings so we have used a repeat loop to make it flap itd wings ten times.
A good way to think of a variable is to imagine a little box into which a number can be placed. The variable must be given a name. We will call it n because it is going to store a number (variables can also store letters and words).
Suppose a player scores 4 goals - we must store 4 in the variable called n. If the player scores another point we will need to add 1 more to the variable. The variable needs to change to the variable plus 1. This can be written as n = n +1 (see the diagram below) so n= 4 + 1 = 5. The player's score is now 5.
We can do this with the script change n by 1.
In the game shown on the right the big green fish has to eat all the little red fish.
The program will hide the red fish when it has been eaten.
The program must make a decision - have the teeth of the large fish touched the red fish?
The movement of the red fish is placed in a loop that will make it repeat forever but if the red colour of the little fish touches the dark blue colour on the teeth of the large fish, the little fish will say 'Got me!' and will then be hidden to make it look as if it has been eaten.
This is also known as selection.