Dark Pong by Harv8th Feb 2009 17:02
|
---|
Summary Pong in DBP stick.png and ball.png are my graphics for that game. It's my first code. Report bugs please. Description Version 0.2: Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com `main sync rate 200 randomize timer() hide mouse `variables start = 0 mainspeed = 5 score1 = 0 score2 = 0 `ball ballx = 305 bally = 225 ballxspeed = 5 ballyspeed = 4 `stick1 stick1x = 40 stick1y = 190 `stick2 stick2x = 585 stick2y = 190 `images `ball load image "graphics/ball.png",1 `stick1 load image "graphics/stick.png",2 `stick2 load image "graphics/stick.png",3 `main loop do if start = 0 text 250,225,"Click any key to start.." wait key start = 1 endif randomize timer() sync cls text 310,15,str$(score1) + " : " + str$(score2) `sprites `ball sprite 1,ballx,bally,1 set sprite 1,1,1 `stick1 sprite 2,stick1x,stick1y,2 `stick2 sprite 3,stick2x,stick2y,3 `main `collisions if sprite hit (1,2) or sprite hit (1,3) then ballxspeed = (ballxspeed * -1) if bally<0 then ballyspeed = (ballyspeed * -1) + rnd(3) if bally>450 then ballyspeed = (ballyspeed * -1) + rnd(-3) if ballx> 610 then score1 = score1 + 1 : ballx = 305 : bally = 225 : ballxspeed = rnd(-5)-1: ballyspeed = rnd(5)+1 : start = 0 if ballx< 0 then score2 = score2 + 1 : ballx = 305 : bally = 225 : ballxspeed = rnd(5)+1 : ballyspeed = rnd(5)+1 : start = 0 if ballxspeed = 0 then ballxspeed = ballxspeed + rnd(3)-3 `ball ballx= ballx + ballxspeed bally= bally + ballyspeed `sticks if stick2y>0 if upkey()=1 then stick2y = stick2y - mainspeed : clear entry buffer endif if stick2y<380 if downkey()=1 then stick2y = stick2y + mainspeed : clear entry buffer endif if stick1y>0 if inkey$()="w" then stick1y = stick1y - mainspeed : clear entry buffer endif if stick1y<380 if inkey$()="s" then stick1y = stick1y + mainspeed : clear entry buffer endif loop |