View
218
Download
4
Category
Preview:
Citation preview
GAME:IT JuniorPing Pong
Objectives: • Review skills from previous lessons• Create a 2-player game• Create a scoring display system • Using old and new skills, develop a game
similar to the original “Pong”
Before you start, you must go into “Advanced Mode”.
Go to: File > Advanced Mode. You know you are in Advanced Mode when the checkmark appears.
In Advanced Mode, there will be a few more icons and functions are now available.
.
2
Here are the 5 sprites you will need to create for Game3.
They are located in Game3 Resources.
They are spr_ball, spr_edge, spr_miss_right, spr_miss_left, spr_paddle_right, spr_paddle_left, and spr_net. NAME THEM AS INSTRUCTED.
3
Create the 3 sounds from the sound files in Game 3 Resources
Snd_beep = beep
Snd_miss = miss
Snd_hit = hit
4
To create a background, just load the background from the Game 3 Resources and call it bckgd_green.
5
Create a font for the scoring display.
1 – Name the font
2 – choose the font
3 – choose the size
4 – check “Bold” to make the font bold
6
Create the above objects using the sprites you created earlier.
obj_ball - visible and solid should be checkedobj_paddle_right - visible and solid should be checkedobj_paddle_left - visible and solid should be checked obj_miss_right - do NOT check either visible or solidobj_miss_left - do NOT check either visible or solid obj_net - visible is checked / solid is NOT checkedobj_edge - visible and solid should be checked
7
Create a Room to look like the one below:
obj_edge
obj_miss_left
obj_miss_right
obj_net
8
Programming the Objects:
Obj_edge:: Has no programming
Obj_miss_right: Has no programming
Obj_miss_left: Has no programming
9
Event 1: Collision with obj_edge
Action: Move FixedApplies to: SelfSelect center button only Speed = 0Relative is NOT checked
Event 2: Keyboard Event - Select <No Key>
Action: Move FixedApplies to: SelfSelect center button only Speed = 0Relative is NOT checked
Obj_paddle_right:
4 Events:
10
Event 3: Keyboard Event - Select <Up>
Action: Move FixedApplies to: SelfSelect Up Arrow only Speed = 7Relative is NOT checked
Obj_paddle_right (cont):
Event 4: Keyboard Event - Select <Down>
Action: Move FixedApplies to: SelfSelect Down Arrow only Speed = 7Relative is NOT checked
11
Event 1: Collision with obj_edge
Action: Move FixedApplies to: SelfSelect center button only Speed = 0Relative is NOT checked
Event 2: Keyboard Event - Select <No Key>
Action: Move FixedApplies to: SelfSelect center button only Speed = 0Relative is NOT checked
Obj_paddle_left:
4 Events:
12
Event 3: Keyboard Event – Letters > A
Action: Move FixedApplies to: SelfSelect Up Arrow only Speed = 7Relative is NOT checked
Obj_paddle_left (cont):
Event 4: Keyboard Event – Letters > Z
Action: Move FixedApplies to: SelfSelect Down Arrow only Speed = 7Relative is NOT checked
13
Obj_ball:
Six Events:
Event 1: Create
3 Actions:
Action 1: Set Score New Score = 0Relative is NOT checked
Action 2: Set LivesNew Lives = 0Relative is NOT checked
Action 3: Move FixedApplies to: SelfSelect 4 cornersSpeed = 5Relative is NOT checked
14
Obj_ball (cont):
Event 2: Collision with obj_edge
Action 1: Bounce against solid objectsApplies to: SelfPrecise = PreciselyAgainst = Solid Objects
Action 2: Play SoundChoose “snd_beep” from the drop downLoop = False
Event 3: Collision with obj_paddle_right
Action: Move FixedApplies to: SelfSelect 3 left facing arrowsSpeed = 5Relative IS NOT checked – this will keep the ball at a constant speed as it collides with the right paddle
15
Obj_ball (cont):
Event 4: Collision with obj_miss_right
Action 1: Jump to StartApplies to: Self
Action 2: Move FixedApplies to: SelfSelect 4 corner arrowsSpeed = 5Relative is NOT checked
Action 3: Set ScoreNew score = 1Relative IS checked
16
Obj_ball (cont):
Event 5: Collision with obj_paddle_left
Action: Move FixedApplies to: SelfSelect 3 right facing arrowsSpeed = 3 Relative IS NOT checked – this will keep the ball at a constant speed as it collides with the left paddle
Event 6: Collision with obj_miss_left
Action 1: Jump to StartApplies to: Self
Action 2: Move FixedApplies to: SelfSelect 4 corner arrowsSpeed = 5Relative is NOT checked
Action 3: Set LivesNew score = 1Relative IS checked
17
Event 1: Draw
7 Actions
Action 1: Draw Sprite (draw tab)Applied to: SelfSprite = spr_netx = 0 y = 0subimage = -1Relative IS checked
Obj_net:
One Event:
Action 2: Set Font (draw tab)Font: choose “font ping pong” from drop downalign: choose “left” from drop down
Action 3: Set ColorChoose a color for the Player 1 Score
Action 4: Draw TextApplies to: SelfText: 'Player 1: ' + string(score) x: 80y: 40Relative is NOT checked
Action 5: Set ColorChoose a color for the Player 2 Score
Obj_net (cont):
19
Action 6: Set Font Font: choose “font ping pong” from drop downalign: choose “left” from drop down
Action 7: Draw TextApplies to: SelfText: 'Player 2: ' + string(lives) x: 400y: 40Relative is NOT checked
Obj_net (cont):
20
Save the Game—Save it as Game3 --It is now ready to play!
Assignment:
Modify the game so that the a sound plays when the players hit AND miss the ball (different sounds)
Also modify the game so that each time the players hit the ball, the ball speeds up. Save it as Game 3A
21
Recommended