Simple Pong w/ No Media by Flaming Ghost13th Mar 2005 15:30
|
---|
Summary This is a simple Pong that I made in my free time. Description This is a basic pong, without score, textures, sounds, just the bare bones programming behind the Physices. Use the Up and Down arrow keys to move both paddles. It dousn't have AI. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com `Made By Skyler a.k.a. Ghost `Set Screen Refresh Rate Sync On `Make Barriors Make Object Cube 10,50 Position Object 10,-80,-185,190 Make Object Cube 11,50 Position Object 11,-30,-185,190 Make Object Cube 12,50 Position Object 12,0,-185,190 Make Object Cube 13,50 Position Object 13,30,-185,190 Make Object Cube 14,50 Position Object 14,60,-185,190 Make Object Cube 15,50 Position Object 15,80,-185,190 Make Object Cube 20,50 Position Object 20,-80,80,190 Make Object Cube 21,50 Position Object 21,-30,80,190 Make Object Cube 22,50 Position Object 22,0,80,190 Make Object Cube 23,50 Position Object 23,30,80,190 Make Object Cube 24,50 Position Object 24,60,80,190 Make Object Cube 25,50 Position Object 25,80,80,190 `Make Paddles Make Object Cube 1,20 position object 1,85,-6,150 Make Object Cube 2,20 Position Object 2,-85,-6,150 `Make Ball Make Object Sphere 3,10 Position Object 3,0,-6,150 `Start the Movement horizontal_speed#=2 vertical_speed#=1 set object collision on 3 height#=-6 `Main Game Loop do position camera 0,10,-20 inc x#,horizontal_speed# inc y#,vertical_speed# position object 3,x#,y#,150 `Move Paddles position object 1,85,height#,150 position object 2,-85,height#,150 `Bouncing Math if object collision(3,0)>0 horizontal_speed#=horizontal_speed#*-1 endif if x#<-130 or x#>115 then horizontal_speed#=horizontal_speed#*-1 if y#<-135 or y#>45 then vertical_speed#=vertical_speed#*-1 if height#<-120 then height#=-120 if height#>43 then height#=43 `Paddle Movement if upkey()=1 height#=height#+2 endif if downkey()=1 height#=height#-2 endif `End Main Game sync loop |