block demolisher 2d by DaFoyle26th Jan 2004 18:34
|
---|
Summary this is a 2d game i wrote, you do have to make the ball, paddle and block images, suggestion: when drawing the block, make a border around it Description HAVE FUN!!! Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com `jake's block demolisher game load image "ball.bmp",1 load image "block.bmp",2 load image "paddle.bmp",3 `sprites 1 to 312 are blocks for X = 10 to 610 step 24 for Y = 1 to 280 step 24 INC I sprite I,X,Y,2 next Y next X sync rate 100 ballx = screen width() / 2 bally = screen height() / 2 + 100 ballspeedX = 2 ballspeedY = 2 do sprite 313,mousex(),440,3 sprite 314,ballx,bally,1 for i = 1 to 312 if sprite collision(314,i) = 1 then ballspeedY= ballspeedY * -1 : delete sprite i next i if ballX <= 1 then ballspeedX = ballspeedX * -1 if ballX >= 639 then ballspeedX = ballspeedX * -1 if ballY <= 1 then ballspeedY = ballspeedY * -1 if sprite collision (313,314) = 1 then ballspeedY=ballspeedY * -1 ballx=ballx+ballspeedX bally=bally+ballspeedY if bally > 500 then wait key : lives = lives - 1 : ballx=0:bally=0:gosub redrawball loop redrawball: ballx = screen width() / 2 bally = screen height() / 2 + 100 ballspeedX = 2 ballspeedY = 2 return |