The Counter Pattern
What is the animation
name?
What is the animation
name?
blue
What is the animation
name?
How many frames?
blue
What is the animation
name?
How many frames?
blue
2
What is Animation’s
name?
What is Animation’s
name?blue
What is the Sprite’s name?What is
Animation’s name?
blue
What is the Sprite’s name?What is
Animation’s name?
bluefish
What code links the sprite to an
animation?
What code links the sprite to an
animation?.setAnimation
What is the initial
position?What code links the sprite to an
animation?.setAnimation
What is the initial
position?What code links the sprite to an
animation?.setAnimation
300, 200
Set up sprites
Steps to repeat
Set up sprites
1. Initialize loop stopping variables
1. Initialize loop stopping variables
2. Test loop stopping condition
1. Initialize loop stopping variables
2. Test loop stopping condition
3. Steps to repeat
1. Initialize loop stopping variables
2. Test loop stopping condition
3. Steps to repeat
4. Progress to the loop stopping condition.
1. Initialize loop stopping variables
2. Test loop stopping condition
3. Steps to repeat
4. Progress to the loop stopping condition.
1. Initialize loop stopping variables
2. Test loop stopping condition
3. Steps to repeat
4. Progress to the loop stopping condition.
Was Pressed?
1. Initialize loop stopping variables
2. Test loop stopping condition
3. Steps to repeat
4. Progress to the loop stopping condition.
Was Pressed?
1. Initialize loop stopping variables
2. Test loop stopping condition
3. Steps to repeat
4. Progress to the loop stopping condition.
Was Pressed?
The Counter Pattern
The Counter Pattern
1. Take the current value of fish.x
The Counter Pattern
1. Take the current value of fish.x
2. Add 1
The Counter Pattern
1. Take the current value of fish.x
2. Add 13. Store it back
in fish.x
The Counter Pattern
1. Take the current value of fish.x
2. Add 13. Store it back
in fish.x
Makes the variable increase by 1.
The Counter Pattern
1. Take the current value of fish.x
2. Add 13. Store it back
in fish.x
Makes the variable increase by 1.
(0,0)
(0,400) (400,400)
(400,0)
(0,0)
(0,400) (400,400)
(400,0)
(0,0)
(0,400) (400,400)
(400,0)
These two lines mean the same
thing.
RightX Pos
LeftX Neg
UpY Neg
DownY Pos
(0,0)
(400,400)
x
y
The Car’s Initial Direction
The Car’s Initial Direction
The Car’s Initial Direction
Hit
Hit
Bounce off
Hit
Hit
Bounce off
Hit
Bo
un
ce o
ff
Hit
Bo
un
ce off