unit 6 motion – air hockey evangel college s.2 ict

18
Unit 6 Motion – Air Hockey Evangel College S.2 ICT

Upload: whitney-west

Post on 18-Jan-2018

214 views

Category:

Documents


0 download

DESCRIPTION

Names of components Mallet Puck Goal Rail Center line

TRANSCRIPT

Page 1: Unit 6 Motion – Air Hockey Evangel College S.2 ICT

Unit 6 Motion – Air Hockey

Evangel CollegeS.2 ICT

Page 2: Unit 6 Motion – Air Hockey Evangel College S.2 ICT

Air Hockey Game• Have you ever played Air Hockey in

game center? Do you want to create this game?

Page 3: Unit 6 Motion – Air Hockey Evangel College S.2 ICT

Names of components

Mallet

Puck

Goal Rail

Center line

Page 4: Unit 6 Motion – Air Hockey Evangel College S.2 ICT

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?

Page 5: Unit 6 Motion – Air Hockey Evangel College S.2 ICT

PuckHow to make the Puck moving

continuously?

Add the “forever” block to wrap the “move” block

What do you find?

Page 6: Unit 6 Motion – Air Hockey Evangel College S.2 ICT

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?

Page 7: Unit 6 Motion – Air Hockey Evangel College S.2 ICT

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?

Page 8: Unit 6 Motion – Air Hockey Evangel College S.2 ICT

MalletHow to make a mallet?

Paint a new sprite and rename it Mallet

Page 9: Unit 6 Motion – Air Hockey Evangel College S.2 ICT

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?

Page 10: Unit 6 Motion – Air Hockey Evangel College S.2 ICT

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.

Page 11: Unit 6 Motion – Air Hockey Evangel College S.2 ICT

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

Page 12: Unit 6 Motion – Air Hockey Evangel College S.2 ICT

Collision detectionWhat should happen when the puck

collides with the mallet?

x

Puck(Start)

Mallet

Puck(Bounce back)

Page 13: Unit 6 Motion – Air Hockey Evangel College S.2 ICT

GoalHow to make the goals of two players?

Paint two new sprites and rename them P1Goal and P2Goal respectively

Page 14: Unit 6 Motion – Air Hockey Evangel College S.2 ICT

GoalWhat should happen when the puck

collides with the goals of players?

Page 15: Unit 6 Motion – Air Hockey Evangel College S.2 ICT

Mix together

Page 16: Unit 6 Motion – Air Hockey Evangel College S.2 ICT

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.

Page 17: Unit 6 Motion – Air Hockey Evangel College S.2 ICT

Programming Concept: Initialization

Initialization:Initialization resets the program to a

certain state.

Page 18: Unit 6 Motion – Air Hockey Evangel College S.2 ICT

Challenging ActivitiesActivity 2 (Randomization):Add script to add a random turning

angle (ranges from -10 to +10 degrees) after bouncing from the mallet.