240 likes | 596 Views
GAME:IT. Ping 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”. Here are the 5 sprites you will need to create for Game3.
E N D
GAME:IT Ping 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”
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. 2
Create the 3 sounds from the sound files in Game 3 Resources Snd_beep = beep Snd_miss = miss Snd_hit = hit 3
To create a background, just load the background from the Game 3 Resources and call it bckgd_green. 4
Create a font for the scoring display. 2 – choose a font 1 – Name the font 4 – choose the size 3 – check “Bold” to make the font bold 5
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 6
Create a Room to look like the one below: obj_edge obj_net obj_miss_left obj_miss_right 7
Programming the Objects: Obj_edge:: Has no programming Obj_miss_right: Has no programming Obj_miss_left: Has no programming 8
Obj_paddle_right: 4 Events: 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 9
Obj_paddle_right (cont): Event 3: Keyboard Event - Select <Up> Action: Move FixedApplies to: SelfSelect Up Arrow only Speed = 7Relative is NOT checked Event 4: Keyboard Event - Select <Down> Action: Move FixedApplies to: SelfSelect Down Arrow only Speed = 7Relative is NOT checked 10
Obj_paddle_left: 4 Events: 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 11
Obj_paddle_left (cont): Event 3: Keyboard Event – Letters > A Action: Move FixedApplies to: SelfSelect Up Arrow only Speed = 7Relative is NOT checked Event 4: Keyboard Event – Letters > ZAction: Move FixedApplies to: SelfSelect Down Arrow only Speed = 7Relative is NOT checked 12
Obj_ball: Six Events: Event 1: Create 3 Actions: Action 1: Set Score New Score = 0Relative is NOT checkedAction 2: Set LivesNew Lives = 0Relative is NOT checkedAction 3: Move FixedApplies to: SelfSelect 4 cornersSpeed = 5Relative is NOT checked 13
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_rightAction: 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 14
Obj_ball (cont): Event 4: Collision with obj_miss_right Action 1: Jump to StartApplies to: SelfAction 2: Move FixedApplies to: SelfSelect 4 corner arrowsSpeed = 5Relative is NOT checked Action 3: Set ScoreNew score = 1Relative IS checked 15
Obj_ball (cont): Event 5: Collision with obj_paddle_left Action: Move FixedApplies to: SelfSelect 3 right facing arrowsSpeed = 5 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: SelfAction 2: Move FixedApplies to: SelfSelect 4 corner arrowsSpeed = 5Relative is NOT checked Action 3: Set LivesNew score = 1Relative IS checked 16
Obj_net: One Event: Event 1: Draw7 ActionsAction 1: Draw Sprite (draw tab)Applied to: SelfSprite = spr_netx = 0 y = 0subimage = -1Relative IS checked Action 2: Set Font (draw tab)Font: choose “font ping pong” from drop downalign: choose “left” from drop down
Obj_net (cont): 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 18
Obj_net (cont): 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 19
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 20