www.jupiter-ace.co.uk
|
| Previous Page > Listings Index > BREAKOUT. |
|
|
OPEN FORUM |
||||||||||||||||||
|
BREAKOUT
on Ace
This program is a version of the standard
breakout game. The player must keep
bouncing the ball back to the top of the
screen in order to demolish the wall. He
has 5 balls to do this, one being lost every
time he misses. The player controls the
movement of his bat by pressing A to
move it to the left and L to move it to the
right. The game will just fit into the standard 3K ACE. Program notes
For those interested, here is a list of the
items on the stack during the game:
(TOS), the position of the ball on the screen, the X displacement at each move, the Y displacement at each move, the score, your position on line 21 of the screen. Anything that appears in brackets inside quotes should be taken as it reads, eg Graphic 4 is the graphic symbol on the 4 key, obtained by pressing Shift and 9 then Symbol Shift and 4. It is important to get the print statement for the score and amount of balls correct, as the number of balls left is fetched (4) for checking. |
: YOUMOVE
INKEY
IF
5 ROLL DUP 21 SWAP
AT 2 SPACES MOVE DUP
21 SWAP AT ." (GRAPHIC
3 GRAPHIC 3)"
5 ROLL 5 ROLL 5
ROLL 5 ROLL
ELSE
50 0
DO
LOOP
THEN
;
: CHECK
DUP 9913 >
IF
32 SWAP C! 9246 C@
DUP ASCII 0 =
IF
ABORT
ELSE
1- 9246 C! 9505 15403
C@ 1 AND +
THEN
THEN
;
: BALLDRAW
DUP C@ 160 =
IF
ROT NEGATE ROT ROT 4
ROLL 1+ 0 8 AT
DUP . 4 ROLL 4
ROLL 4 ROLL
THEN
79 OVER C!
;
400 VARIABLE S
: DRAW
CLS 0 1 AT ." Score: 0
Balls: 5"
4 0 AT 32 5 * 0
DO
." (INVERSE SPACE)"
LOOP
1 0 AT ." (GRAPHIC 4)"
30 0
DO
." (INVERSE GRAPHIC 3)"
LOOP
." (INVERSE GRAPHIC 7)"
23 2
DO
I 0 AT . " (GRAPHIC 5)"
|
I 31 AT ." (INVERSE GRAPHIC 5)" LOOP ; : MOVE INKEY DUP 97 = SWAP 108 = OVER OR IF IF 1- ELSE 1+ THEN ELSE DROP THEN 1 MAX 29 MIN ; : BALLMOVE 32 OVER C! OVER OVER + C@ DUP 32 = SWAP 160 = OR 0= IF SWAP NEGATE SWAP THEN DUP 4 PICK + C@ DUP 32 = SWAP 160 = OR 0= IF ROT NEGATE ROT ROT THEN OVER OVER + 4 PICK. + C@ DUP 32 = SWAP 160 = OR 0= IF ROT NEGATE ROT NEGATE ROT THEN OVER 4 PICK + + BALLDRAW ; : B 8 0 32 1 9505 DRAW 21 8 AT ." (GRAPHIC 3 GRAPHIC 3)" BEGIN YOUMOVE BALLMOVE YOUMOVE CHECK S @ 0 DO LOOP 0 UNTIL ; : SPEED S ! ; Breakout
by Colin Dooley |
||||||||||||||||
|
|
||||||||||||||||||