unit 6 motion – air hockey evangel college s.2 ict
DESCRIPTION
Names of components Mallet Puck Goal Rail Center lineTRANSCRIPT
Unit 6 Motion – Air Hockey
Evangel CollegeS.2 ICT
Air Hockey Game• Have you ever played Air Hockey in
game center? Do you want to create this game?
Names of components
Mallet
Puck
Goal Rail
Center line
PuckHow to make a movable puck?
Paint a new sprite and rename it Puck
Add the “move” block to the script area of Puck. Click on the “move” block.
What do you find?
PuckHow to make the Puck moving
continuously?
Add the “forever” block to wrap the “move” block
What do you find?
PuckHow to make the Puck bounce on the
edge of the air hockey table?
Add the “if on edge, bounce” block at the end of the stack.
What do you find?
PuckHow to change the direction of the
Puck so that it does not just move left and right?
Add the “point in direction” before “forever” block and adjust the direction value.
What do you find?
MalletHow to make a mallet?
Paint a new sprite and rename it Mallet
MalletHow to make the Mallet stick to the mouse?
Add the “go to ” block to the script area of Mallet
Change the position to “mouse-pointer”.Wrap it with “forever” block.
What do you find?
Collision detectionHow detect collision between two
sprites?
The “touching” block can detect collision of the sprite with other sprites. It can be used in condition blocks such as “if” block, “if-else” block or “wait until” block.
Programming Concept: Condition
Conditional statement:A program may
perform different actions depending on the boolean condition evaluated to be true or false. It is very commonly used in programming.
Key pressed?
Turn back
Face the mallet
Yes
No
Collision detectionWhat should happen when the puck
collides with the mallet?
x
Puck(Start)
Mallet
Puck(Bounce back)
GoalHow to make the goals of two players?
Paint two new sprites and rename them P1Goal and P2Goal respectively
GoalWhat should happen when the puck
collides with the goals of players?
Mix together
Extended ActivityActivity 1 (Initialization):Add script to reset the position of the
puck to the center (0, 0) of the stage at the beginning of the game.
Programming Concept: Initialization
Initialization:Initialization resets the program to a
certain state.
Challenging ActivitiesActivity 2 (Randomization):Add script to add a random turning
angle (ranges from -10 to +10 degrees) after bouncing from the mallet.