'_FullScreen
crap:
Print "Error, error line"
beginning:
Const leftDirection
= 19200 ' to make the code more readable with the left and right arrowkeys Const rightDirection
= 19712 ' Const upAndLeft
= 1 'the ball always moves in one diagonal direction Const theBackground
= 0 ' to determine what the ball hit Const hitWallSound$
= "O2L30G" Const hitPaddleSound$
= "O3L30C" Const hitBrickSound$
= "O3L30G" Const deathSound$
= "O4L15CO3CO2CO1L10C" Const successBeep
= "L9O2DL15DL9DL4F"
For initializeArrayX
= 2 To 79 For initializeArrayY
= 2 To 46 creationBoard(initializeArrayX, initializeArrayY) = 1
Dim Shared brick
As coordinate: brick.x
= 2: brick.y
= 2 Dim Shared spaceToStart: spaceToStart
= FALSE
Dim Shared penUp
, currentColor
, eraserOn
As Integer: penUp
= TRUE: currentColor
= 0: eraserOn
= FALSE
levelChecking = levelChecking + 1
lastLevelCreated = levelChecking - 1
printTheMenu = TRUE
Print CenterText$
("Menu") Print CenterText$
("------") Print CenterText$
("1.) Instructions") Print CenterText$
("2.) Create A Level") Print CenterText$
("3.) Play The Game") Print CenterText$
("4.) Exit") printTheMenu = FALSE
printTheMenu = TRUE
printTheMenu = TRUE
printTheMenu = TRUE
Print CenterText$
("Level Creator") Print CenterText$
("---------------") Print CenterText$
("The available commands are listed at the bottom of the screen.") Print CenterText$
("When the pen is up, the cursor moves without adding to the level") Print CenterText$
("being created. When the pen is down the current brick is added") Print CenterText$
("to the level being created. The other commands are self explanatory.") Print CenterText$
("When the created level is saved, it is saved under " + Chr$(34) + "Level #" + Chr$(34) + ".") Print CenterText$
("If no levels have been created, the default level is used.") Print CenterText$
("If you progress beyond all levels created, the last level created repeats.") Print CenterText$
("Game") Print CenterText$
("------") Print CenterText$
("The object of the game is to progress to the next level by") Print CenterText$
("destroying all of the bricks. To do this you must position the") Print CenterText$
("under the square so that it is reflected toward the bricks using.") Print CenterText$
("the left and right arrow keys.") Print CenterText$
("Push C to turn on debug mode and O to turn it off.") Print CenterText$
("Push any key to continue.")
returnString$
= Space$(Int((80 - Len(thisString$
)) / 2)) + thisString$
CenterText = returnString$
Sub PrintBrick
(x
, y
, onOrOff
) useColor = board(x, y, 2) 'print the brick instead of erasing it, pick up the color there
useColor = 1
board(x + across, y, 1) = 219
board(x + across, y, 2) = useColor
numberOfBricks = numberOfBricks - 1
score = score + 5
For x
= 1 To 80:
For y
= 1 To 48 'make the board blue board(x, y, 1) = 219 ' ASCII code of board space
board(x, y, 2) = 1 ' color of board space
'print left, right and top borders
Call PlaceChar
(1, y
, 219, 12) ' put the position, ASCII code and color on the board to make the left border Call PlaceChar
(80, y
, 219, 12) ' same to make the left border on the board Call PlaceChar
(x
, 1, 219, 12) ' put the top border on the board paddleLeft = 36
Call PrintPaddle
(TRUE
) ' put the paddle on the board with the left at x coordinate 36 ball.x = 40: ball.y = 47 ' position the ball/moving square
Call PrintBall
(TRUE
) ' put the ball on the board ballDirection
= Int(Rnd * 2) + 1 'randomize the starting direction of the ball as up and left or up and right
filename$ = "Level " + S$(currentLevel)
' If _FileExists(filename$) = 0 Then Print " no level file found": End ' <---- DEBUG
Open filename$
For Input As #1 'open the file with the level information For xCounting
= 2 To 79 ' x coordinate of the board For yCounting
= 2 To 46 ' y coordinate of the board Input #1, boardColor$
' get the color of the board at xCounting, yCounting board
(xCounting
, yCounting
, 2) = Val(boardColor$
) 'color the board at xCounting, yCounting ' LOCATE 20, 20: COLOR 15, 0: PRINT "Filename: " + filename$: CALL P
Else ' if no levels were created Call PlaceChar
(x
, 2, 219, 14) 'put a yellow (14) block (219) at x, y on the board Call PlaceChar
(x
, 4, 219, 14) Call PlaceChar
(x
, 6, 219, 14) lastLevelCreated = 1 'DEBUG CODE
numberOfBricks = 0 ' after a level has been put on the board, count the number of bricks on it
For brickCountingY
= 2 To 47 For brickCountingX
= 2 To 79 Step 6 'each brick is 6 blocks long If board
(brickCountingX
, brickCountingY
, 2) <> 1 Then numberOfBricks
= numberOfBricks
+ 1 Call PrintBoard
'print the board to the screen spaceToStart = FALSE 'spacebar has yet to be puched to start the current level
Call PrintLevel
'put the current level on the board and print it out printOutBoard = FALSE ' to avoid flicker of the board being constantly printed, the need to print it is false
delaySpeed = 0.029 'delay to use inside the main DO-LOOP
Locate 48, 1:
Print "Level"; currentLevel;
' DEBUG OUTPUT debugging$
= InKey$ 'using strings instead of _KEYDOWN(code) is easier. i initially added INKEY$ for debugging If spaceToStart
= TRUE
Then ' the spacebar has been hit to start the game Call PrintBall
(FALSE
) 'remove the ball from the board Call MoveBall
'move the ball in the current direction Call PrintBall
(TRUE
) 'put the ball on the board at the new position If _KeyDown(leftDirection
) = -1 Then 'the left arrow key had been pushed Call PrintPaddle
(FALSE
) ' remove the paddle from the board paddleLeft = paddleLeft - 1.5 ' move the paddle leftward
Call PrintPaddle
(TRUE
) ' put the paddle on the board at the new position printOutBoard = TRUE 'it is now needed to print the board to the screen
paddleLeft = paddleLeft + 1.5
printOutBoard = TRUE
If printOutBoard
= TRUE
Then 'print the board to the screen Call PrintBoard
' print the board to the screen printOutBoard = FALSE 'stop the board from being printed now
If numberOfBricks
= 0 Then 'there are no bricks left on the board ' lastLevelCreated = currentLevel ' DEBUG SETTING
currentLevel = currentLevel + 1 'increment the current level
Call PrintLevel
'put the newest level on the board spaceToStart = FALSE 'the spacebar has not been pressed since the new level has been output
score = score + 200 '200 points for finishing a level
If mute
= -1 Then Play successBeep
'1 is mute, -1 is note muted If debugging$
= "C" Then debugMode
= TRUE
If debugging$
= "O" Then debugMode
= FALSE
spaceToStart = TRUE ' the spacebar has been pushed
printOutBoard = TRUE ' it is needed to print the board to the screen
_Delay (delaySpeed
) ' insert a delay to make the movement playable and visible If score
Mod 2000 = 0 And score
<> 0 Then numberOfGuys
= numberOfGuys
+ 1 ' new guy every 2,000 points If debugging$
= "+" Then 'increase the game speed delaySpeed = delaySpeed - 0.01
If delaySpeed
< 0 Then delaySpeed
= 0 'don't allow a negative delay If debugging$
= "-" Then delaySpeed
= delaySpeed
+ 0.005 'decrease the game speed If debugging$
= "m" Or debugging$
= "M" Then mute
= mute
* -1 'turn mute on or off If debugging$
= "p" Or debugging$
= "P" Then pause$
= Input$(1) 'pause the game ' DEBUG CODE TO JUMP LEVEL
numberOfBricks = 0 ' jump to the next level
' lastLevelCreated = lastelevelcreated + 1
' END DEBUG CODE
'if 12 then border, if 1 then background, if 15 then paddle, else brick
rtn = -1
rtn = theWall
rtn = theBackground
rtn = thePaddle
rtn = theBrick
Report = rtn
ball.x = ball.x + 1
ball.y = ball.y - 1
'hit the right wall
ballDirection = upAndLeft
'hit top wall
ballDirection = downAndRight
leftSideOfBrick = findBrickLeft(ball.x + 1)
vertOfBrick = findBrickVertical(ball.y - 1)
Call PrintBrick
(leftSideOfBrick
, vertOfBrick
, FALSE
) ballDirection = downAndRight
ball.x = ball.x - 1
ball.y = ball.y - 1
ballDirection = upAndRight
ballDirection = downAndLeft
leftSideOfBrick = findBrickLeft(ball.x - 1)
vertOfBrick = findBrickVertical(ball.y - 1)
Call PrintBrick
(leftSideOfBrick
, vertOfBrick
, FALSE
) ballDirection = downAndLeft
manDied = TRUE
score = score - 50
spaceToStart = FALSE
ball.x = 40: ball.y = 47
paddleLeft = 36
ballDirection
= Int(Rnd * 2) + 1 numberOfGuys = numberOfGuys - 1
ballDirection = upAndRight
ball.x = ball.x + 1
ball.y = ball.y - 1
ball.x = ball.x + 1
ball.y = ball.y + 1
If ball.x
+ 1 = 80 Then ballDirection
= downAndLeft
leftSideOfBrick = findBrickLeft(ball.x + 1)
vertOfBrick = findBrickVertical(ball.y + 1)
Call PrintBrick
(leftSideOfBrick
, vertOfBrick
, FALSE
) ballDirection = upAndRight
ballDirection = upAndRight
manDied = TRUE
score = score - 50
spaceToStart = FALSE
ball.x = 40: ball.y = 47
paddleLeft = 36
ballDirection
= Int(Rnd * 2) + 1 numberOfGuys = numberOfGuys - 1
ballDirection = upAndLeft
ball.x = ball.x - 1
ball.y = ball.y - 1
ball.x = ball.x - 1
ball.y = ball.y + 1
If ball.x
- 1 = 1 Then ballDirection
= downAndRight
leftSideOfBrick = findBrickLeft(ball.x - 1)
vertOfBrick = findBrickVertical(ball.y + 1)
Call PrintBrick
(leftSideOfBrick
, vertOfBrick
, FALSE
) ballDirection = upAndLeft
ballDirection = upAndLeft
rtn = 0
findBrickLeft = rtn
rtn = 0
findBrickVertical = rtn
useColor = 11
useColor = 1
Call PlaceChar
(ball.x
, ball.y
, 254, useColor
)
Sub PrintPaddle
(onOrOff
) theColor = 15
theColor = 1
If paddleLeft
< 2 Then paddleLeft
= 2 If paddleLeft
> 72 Then paddleLeft
= 72 Call PlaceChar
(Int(paddleLeft
) + across
, 48, 219, theColor
)
Sub PlaceChar
(X
, Y
, char
, clr
) board(X, Y, 1) = char
board(X, Y, 2) = clr
this$
= Chr$(board
(x
, y
, 1)) theColor = board(x, y, 2)
Else 'IF theColor <> 1 THEN Print " Bricks remaining: " + S$
(numberOfBricks
) + " ";
Print " Score: " + S$
(score
) + " "
penUp = TRUE
eraserOn = FALSE
currentColor = 0
brick.x = 2
brick.y = 2
creationBoard(countX, countY) = 1
printOutCurrentBoard = FALSE
penUp = FALSE
penUp = TRUE
printOutCurrentBoard = TRUE
eraserOn = TRUE
currentColor = 1
penUp = FALSE
eraserOn = FALSE
currentColor = 0
penUp = TRUE
printOutCurrentBoard = TRUE
currentColor = 2
currentColor = 13
currentColor = currentColor + 1
currentColor = 0
printOutCurrentBoard = TRUE
penUp = TRUE
eraserOn = FALSE
currentColor = 0
creationBoard(xCount, yCount) = 1
printOutCurrentBoard = TRUE
brick.y = brick.y - 1
printOutCurrentBoard = TRUE
brick.x = brick.x - 6
printOutCurrentBoard = TRUE
brick.y = brick.y + 1
printOutCurrentBoard = TRUE
brick.x = brick.x + 6
printOutCurrentBoard = TRUE
If printOutCurrentBoard
= TRUE
Then printOutCurrentBoard = FALSE
highestLevel = 0
highestLevel = highestLevel + 1
Print "It will automatically be loaded after Level " + S$
(highestLevel
- 1) + " is completed." If Len(stringOut$
) = 1 Then stringOut$
= " " + stringOut$
a$
= "Push " + Chr$(34) + "A" + Chr$(34) + " to make (a)nother level"
creationBoard(brick.x + counting, brick.y) = currentColor
Locate brick.y
, brick.x
+ count
Color creationBoard
(x
, y
), 1
Print "Use the Arrow Keys To Move P - Pen ";
'LOCATE 20, 20: COLOR 15, 0: PRINT "eraserOn = " + S$(eraserOn): CALL P
' LOCATE 48, 26
Print " S - Save [ESC] - End Without Save" ' LOCATE 45, 10: COLOR 10, 1: PRINT "eraserOn = " + S$(eraserOn)