Hi
It was to hot this afternoon to do anything outside to do much so.
I left a lot out of this so it would be fairly easy to follow the code.
although its not a complete game it runs correctly for one level.
As I understand it Gary wants some simple games so I left out all the
fancey stuff to keep it simple.
This runs fine and has plenty of room for people to add some frills and whistles
if they want.
here are some suggestions you could add to or change in the game.
Add some randomness to it so the ball starts a differant location each time.
Make it so the ball goes at differant angles on differant levels etc
Make it so the game continues 3 or 4 times after missing the ball. Right now
it ends the game when you miss the ball. LOL
Make levels where the ball goes faster each level when the bricks are all cleared.
Make the rows of brick differant colors for eye candy.
There are a ton of fun things that could be added to it or changed.
Better yet start from scratch and write one.
Come on guys, Write some games to add on here, I want to play your games!!
I have some complete programs and games on here now. Where are yours
I see folks talking about how to write programs and etc. but I never see
any real programs come of it, just short samples a lot of which are not all the usefull.
Short samples of stuff get boring after a while.
Dustie
USE left/right arrow keys to move the paddle, press q to end the program.
SCREEN 12
DIM SHARED BallY, BallYY, BallX, BallXX, Blocks
BallY = 200: BallYY = -.3: BallX = 200: BallXX = .2
FOR x = 1 TO 600 STEP 64 ' --- Draw the Blocks
LINE (x, 50)-(x + 60, 60), 2, BF
LINE (x, 65)-(x + 60, 75), 2, BF
LINE (x, 80)-(x + 60, 90), 2, BF
LINE (x, 95)-(x + 60, 105), 2, BF
NEXT x
LINE (300, 350)-(360, 360), 6, BF ' --- Draw the paddle
DO WHILE a$ <> LCASE$("q")
a$ = INKEY$
' ----- Moving the paddle ------
IF _KEYDOWN(CVI(CHR$(0) + "M")) THEN
LINE (300 + m, 350)-(360 + m, 360), 0, BF ' -- Erase old paddle position
m = m + 1
LINE (300 + m, 350)-(360 + m, 360), 6, BF ' -- Draw new paddle position
END IF
IF _KEYDOWN(CVI(CHR$(0) + "K")) THEN
LINE (300 + m, 350)-(360 + m, 360), 0, BF ' -- Erase old paddle position
m = m - 1
LINE (300 + m, 350)-(360 + m, 360), 6, BF ' -- Draw new paddle position
END IF
' ----------------
BallMove
' -- Missed the ball if went below the paddle
IF BallY > 400 THEN: LOCATE 29, 30: PRINT " Paddle missed the Ball";: _DISPLAY: SLEEP: SYSTEM ' -- Missed the ball
' ----------------
_LIMIT 400
_DISPLAY
LOOP
SYSTEM
'____________________________________
SUB BallMove
CIRCLE (BallX, BallY), 5, 0 ' -- erase old ball position
PAINT (BallX, BallY), 0
' -- Control X direction
BallY = BallY + BallYY
BallX = BallX + BallXX
IF BallX < 5 THEN BallXX = .2 ' -- reverse X direction
IF BallX > 630 THEN BallXX = -.2
CIRCLE (BallX, BallY), 5, 7 ' -- Draw new ball
PAINT (BallX, BallY), 7
' -- Reverse y when ball hits top of screen
IF BallY < 5 THEN BallYY = .4
' -- Reverse BallYY when ball hits bottom of blocks
IF POINT(BallX - 5, BallY - 11) = 2 OR POINT(BallX + 5, BallY - 11) = 2 THEN
BallYY = .4
PAINT (BallX - 4, BallY - 11), 0 ' -- Erase Block that was hit
PAINT (BallX + 4, BallY - 11), 0
END IF
' -- Reverse BallYY when ball hits top of blocks
IF POINT(BallX - 5, BallY + 11) = 2 OR POINT(BallX + 5, BallY + 11) = 2 THEN
BallYY = -.4
PAINT (BallX - 4, BallY + 11), 0 ' -- Erase Block that was hit
PAINT (BallX + 4, BallY + 11), 0
END IF
' -- Reverse BallYY when ball hits paddle
IF POINT(BallX + 4, BallY + 6) = 6 OR POINT(BallX - 4, BallY + 6) = 6 THEN BallYY = -.4
END SUB