Pete (Login The-Universe) R from IP address 70.177.5.114
DEFINT A-Z SCREEN 13
CONST MAXBULLETS = 16 AMBX = 199 DIM bullets(MAXBULLETS - 1, 1) AS INTEGER DIM a(30, 30)'pixel array -- make it bigger for a bigger sprite delay% = 8
RESTORE shooterdata FOR J = 0 TO 30 FOR I = 0 TO 30 READ a(I, J) NEXT NEXT
RESTORE blooddata FOR y = 0 TO 9 FOR x = 0 TO 8 READ blood PSET (x, y), blood NEXT x NEXT y
DIM blood%(90) GET (0, 0)-(9, 10), blood%
FOR y = 0 TO 9 FOR x = 0 TO 8 READ needle PSET (x, y), needle NEXT x NEXT y
DIM needle%(90) GET (0, 0)-(9, 10), needle%
FOR y = 0 TO 9 FOR x = 0 TO 8 READ cross PSET (x, y), cross NEXT x NEXT y
DIM cross%(90) GET (0, 0)-(9, 10), cross%
FOR y = 0 TO 9 FOR x = 0 TO 17 READ barrier PSET (x, y), barrier NEXT x NEXT y
DIM barrier%(153) GET (0, 0)-(17, 10), barrier% CLS ex = -24: REM start 24 spaces to the left inc = 2
DO GOSUB drawenemies IF ex = 48 OR ex = -24 AND inc < 0 THEN ey = ey + 2: inc = -inc ex = ex + inc IF ey = 66 THEN STOP: REM hits base GOSUB delay CLS GOSUB redrawbase GOSUB shooter LOOP
drawenemies: PUT (ex + 85, ey + 0), needle PUT (ex + 100, ey + 0), needle PUT (ex + 115, ey + 0), needle PUT (ex + 130, ey + 0), needle PUT (ex + 145, ey + 0), needle PUT (ex + 160, ey + 0), needle PUT (ex + 175, ey + 0), needle PUT (ex + 190, ey + 0), needle PUT (ex + 205, ey + 0), needle PUT (ex + 220, ey + 0), needle
PUT (ex + 75, ey + 15), cross PUT (ex + 90, ey + 15), cross PUT (ex + 105, ey + 15), cross PUT (ex + 120, ey + 15), cross PUT (ex + 135, ey + 15), cross PUT (ex + 150, ey + 15), cross PUT (ex + 195, ey + 15), cross PUT (ex + 210, ey + 15), cross
PUT (ex + 85, ey + 30), blood PUT (ex + 100, ey + 30), blood PUT (ex + 115, ey + 30), blood PUT (ex + 130, ey + 30), blood PUT (ex + 145, ey + 30), blood PUT (ex + 160, ey + 30), blood PUT (ex + 175, ey + 30), blood PUT (ex + 190, ey + 30), blood PUT (ex + 205, ey + 30), blood PUT (ex + 220, ey + 30), blood
PUT (ex + 75, ey + 45), needle PUT (ex + 90, ey + 45), needle PUT (ex + 105, ey + 45), needle PUT (ex + 120, ey + 45), needle PUT (ex + 135, ey + 45), needle PUT (ex + 150, ey + 45), needle PUT (ex + 165, ey + 45), needle PUT (ex + 180, ey + 45), needle PUT (ex + 195, ey + 45), needle PUT (ex + 210, ey + 45), needle
PUT (ex + 85, ey + 60), cross PUT (ex + 100, ey + 60), cross PUT (ex + 115, ey + 60), cross PUT (ex + 130, ey + 60), cross PUT (ex + 145, ey + 60), cross PUT (ex + 160, ey + 60), cross PUT (ex + 175, ey + 60), cross PUT (ex + 190, ey + 60), cross PUT (ex + 205, ey + 60), cross PUT (ex + 220, ey + 60), cross
PUT (ex + 75, ey + 75), blood PUT (ex + 90, ey + 75), blood PUT (ex + 105, ey + 75), blood PUT (ex + 120, ey + 75), blood PUT (ex + 135, ey + 75), blood PUT (ex + 150, ey + 75), blood PUT (ex + 165, ey + 75), blood PUT (ex + 180, ey + 75), blood PUT (ex + 195, ey + 75), blood PUT (ex + 210, ey + 75), blood RETURN
shooter: 'Setup program and data
'Make each slot empty (set both coordinates to -1) FOR bul = 0 TO UBOUND(bullets, 1) bullets(bul, 0) = -1 bullets(bul, 1) = -1 NEXT bul
'Main loop DO IF OLDAMBX <> AMBX THEN LINE (OLDAMBX, 150)-(OLDAMBX + 35, 170 + 35), 0, BF END IF OLDAMBX = AMBX 'Update objects 'For each bullet FOR bul = 0 TO UBOUND(bullets, 1) 'If it's not an empty slot IF NOT (bullets(bul, 0) = -1 AND bullets(bul, 1) = -1) THEN 'Erase the bullet from it's old position PSET (bullets(bul, 0), bullets(bul, 1)), 0
'Move the bullet up one pixel bullets(bul, 1) = bullets(bul, 1) - 1
'If it's off the screen, make it an empty slot again IF bullets(bul, 1) < 0 THEN bullets(bul, 0) = -1 bullets(bul, 1) = -1 'Otherwise, draw it in it's new spot ELSE 'Draw the bullet PSET (bullets(bul, 0), bullets(bul, 1)), 15 END IF END IF NEXT bul FOR J = 0 TO 30 FOR I = 0 TO 30 PSET (I + AMBX, 170 + J), a(I, J) NEXT NEXT 'Get user input a$ = INKEY$ IF a$ <> "" THEN REM allows a redraw even when key is held down nodelay = 1 switchvar = switchvar + 1: IF switchvar > 1 THEN switchvar = 0: a$ = "": nodelay = 0 END IF SELECT CASE a$ 'Fire a bullet CASE CHR$(32) FOR bul = 0 TO UBOUND(bullets, 1) 'Create a new bullet if it's an empty slot IF (bullets(bul, 0) = -1 AND bullets(bul, 1) = -1) THEN bullets(bul, 0) = INT(AMBX + 9) bullets(bul, 1) = 170 EXIT FOR END IF NEXT bul CASE CHR$(27) SYSTEM CASE CHR$(0) + CHR$(75) IF AMBX > 0 THEN AMBX = AMBX - 5 CASE CHR$(0) + CHR$(77) IF AMBX < 320 THEN AMBX = AMBX + 5 CASE "": RETURN END SELECT
'Delay for 1/10th of a second ''''''''IF switchvar = 0 THEN RETURN STime! = TIMER WHILE TIMER - STime! < .01: WEND LOOP 'End program RETURN
redrawbase: '***PUT*** CLS PUT (75, 150), barrier PUT (125, 150), barrier PUT (175, 150), barrier PUT (225, 150), barrier RETURN
delay: IF nodelay = 1 THEN nodelay = 0: RETURN FOR Reps% = 1 TO delay% WAIT &H3DA, 8 WAIT &H3DA, 8, 8 NEXT Reps% RETURN
shooterdata: DATA 00,00,00,00,00,00,00,00,00,04,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 DATA 00,00,00,00,00,00,00,00,00,04,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 DATA 00,00,00,00,15,00,00,04,00,04,00,04,00,00,15,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 DATA 00,00,00,00,15,15,00,04,15,04,15,04,00,15,15,00,00,00,14,04,14,00,00,00,00,00,00,00,00,00,00 DATA 00,00,00,00,15,15,15,04,04,04,04,04,15,15,15,00,00,00,04,14,04,00,00,00,00,00,00,00,00,00,00 DATA 00,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,00,00,00,00,00,00,00,00,00,00 DATA 00,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,03,17,03,15,00,00,00,00,00,00,00,00,00 DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,03,17,03,15,00,00,00,00,00,00,00,00,00 DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,03,17,17,15,00,00,00,00,00,00,00,00,00 DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,03,17,03,15,00,00,00,00,00,00,00,00,00 DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,15,15,15,15,12,12,00,00,00 DATA 00,15,15,04,04,04,04,04,04,04,04,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,12,12,12,00,00 DATA 00,15,15,04,04,04,04,04,04,04,04,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,12,12,12,00,00 DATA 00,15,15,04,04,04,04,04,04,04,04,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,12,12,12,00,00 DATA 00,15,15,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,08,08,00,00 DATA 00,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,08,00,00 DATA 00,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,08,08,00,00 DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,08,00,00 DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,08,08,00,00 DATA 00,15,15,15,17,17,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,17,17,15,15,15,00,00 DATA 00,06,06,17,08,08,17,06,06,06,06,06,06,06,06,06,06,06,06,06,06,04,06,17,08,08,17,06,00,00,00 DATA 00,15,17,08,08,08,08,17,15,15,15,15,15,15,15,15,15,15,15,15,15,15,17,08,08,08,08,17,00,00,00 DATA 00,00,00,08,08,08,08,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,08,08,08,08,00,00,00,00 DATA 00,00,00,00,08,08,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,08,08,00,00,00,00,00 DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
'**BLOOD** blooddata: DATA 17,17,17,17,04,17,17,17,17 DATA 17,17,17,04,04,04,17,17,17 DATA 17,17,04,04,04,04,04,17,17 DATA 17,04,04,04,04,04,04,04,17 DATA 04,04,04,04,04,04,04,04,04 DATA 04,04,04,04,04,04,04,04,04 DATA 04,04,04,04,04,04,04,04,04 DATA 04,04,04,04,04,04,04,04,04 DATA 17,04,04,04,04,04,04,04,17 DATA 17,17,17,04,04,04,17,17,17
'**NEEDLE** needledata: DATA 00,00,00,00,00,00,00,00,15 DATA 00,00,00,00,15,00,15,15,00 DATA 00,00,00,00,00,15,04,15,00 DATA 00,00,00,00,15,04,15,00,00 DATA 00,15,00,15,04,15,00,15,00 DATA 00,00,15,04,15,00,00,00,00 DATA 00,00,04,15,00,00,00,00,00 DATA 00,04,00,00,15,00,00,00,00 DATA 04,00,00,00,00,00,00,00,00 DATA 00,00,00,00,00,00,00,00,00
'**CROSS** crossdata: DATA 15,15,15,15,15,15,15,15,15 DATA 15,15,15,04,04,04,15,15,15 DATA 15,15,15,04,04,04,15,15,15 DATA 15,04,04,04,04,04,04,04,15 DATA 15,04,04,04,04,04,04,04,15 DATA 15,04,04,04,04,04,04,04,15 DATA 15,15,15,04,04,04,15,15,15 DATA 15,15,15,04,04,04,15,15,15 DATA 15,15,15,04,04,04,15,15,15 DATA 15,15,15,15,15,15,15,15,15
'*** Barrier barrierdata: DATA 00,00,00,02,02,02,02,02,02,02,02,02,02,02,02,00,00,00 DATA 00,00,02,02,02,02,02,02,02,02,02,02,02,02,02,02,00,00 DATA 00,02,02,09,09,09,09,09,09,09,09,09,09,09,09,02,02,00 DATA 02,02,02,09,02,02,12,12,12,12,12,12,02,02,09,02,02,00 DATA 02,02,02,09,02,02,12,00,00,00,00,12,02,02,09,02,02,02 DATA 02,02,02,09,02,02,12,00,00,00,00,12,02,02,09,02,02,02 DATA 02,02,02,09,02,02,00,00,00,00,00,00,02,02,09,02,02,02 DATA 02,02,02,09,02,00,00,00,00,00,00,00,00,02,09,02,02,02 DATA 02,02,02,09,00,00,00,00,00,00,00,00,00,00,09,02,02,02 DATA 02,02,02,00,00,00,00,00,00,00,00,00,00,00,00,02,02,02
---------------------------------------------
Pete
Here's the deal. Combining just takes making the new addition into a SUB. Then, you have to do things like RESTORE to tell the program which data to read. I like to stack all data statements at the end. OK, you do have to take out extra CLS and screen statements and it alos helps to move constant variables to the top of the program.
Most importantly is to make the program cycle through everything. I included a new case in INKEY for this. If no key is selected, it cycles. If a key is held down, the cycle is still possible because of a new variable, called SWITCHVAR.
Now your part is to concentrate on the next task, which is trying to figure out how to keep that bullet going!
- Notice that it is in a for loop and to make it functional, it has to cycle out of that loop every time to redraw the rest of the screen.
Good luck,
Pete
This message has been edited by The-Universe from IP address 70.177.5.114 on Apr 21, 2008 5:46 PM
DIM Image(10000) SCREEN 9, , 0, 1 '====================Page 0 (first) PALETTE 0, 8 COLOR 9: LOCATE 2, 10: PRINT "SCREEN 9, , 1, 0" FOR i% = 0 TO 7: CIRCLE (168, 100), 39 - i%, 9, 4.7, 1.57: NEXT i% LINE (160, 70)-(170, 160), 9, BF ' full box FOR i% = 0 TO 10: LINE (254 + i%, 70)-(215 + i%, 160), 9: NEXT i% FOR i% = 0 TO 10: LINE (254 + i%, 70)-(281 + i%, 160), 9: NEXT i% FOR i% = 0 TO 10: LINE (243, 110 + i%)-(269, 110 + i%), 9: NEXT i% FOR i% = 0 TO 9: CIRCLE (354, 114), 46 - i%, 9, .785, 0, 1.5: NEXT i% LINE (376, 114)-(394, 120), 9, BF ' full box FOR i% = 0 TO 9: LINE (429 + i%, 70)-(429 + i%, 160), 9: NEXT i% FOR i% = 0 TO 6: LINE (435, 70 + i%)-(476, 70 + i%), 9: NEXT i% FOR i% = 0 TO 6: LINE (435, 115 + i%)-(461, 115 + i%), 9: NEXT i% FOR i% = 0 TO 6: LINE (438, 154 + i%)-(472, 154 + i%), 9: NEXT i% FOR i% = 1 TO 10: CIRCLE (291, 240), 60 - i%, 9, , , 2: NEXT i% SCREEN 9, , 1, 0 '===================Page 1 (Second) CLS COLOR 13: LOCATE 2, 10: PRINT "SCREEN 9, , 0, 1" FOR i% = 0 TO 7: CIRCLE (118, 100), 39 - i%, 13, 4.7, 1.57: NEXT i% LINE (110, 70)-(120, 160), 13, BF ' full box FOR i% = 0 TO 10: LINE (204 + i%, 70)-(165 + i%, 160), 13: NEXT i% FOR i% = 0 TO 10: LINE (204 + i%, 70)-(231 + i%, 160), 13: NEXT i% FOR i% = 0 TO 10: LINE (193, 110 + i%)-(219, 110 + i%), 13: NEXT i% FOR i% = 0 TO 9: CIRCLE (304, 114), 46 - i%, 13, .785, 0, 1.5: NEXT i% LINE (326, 114)-(344, 120), 13, BF ' full box FOR i% = 0 TO 9: LINE (379 + i%, 70)-(379 + i%, 160), 13: NEXT i% FOR i% = 0 TO 6: LINE (385, 70 + i%)-(426, 70 + i%), 13: NEXT i% FOR i% = 0 TO 6: LINE (385, 115 + i%)-(411, 115 + i%), 13: NEXT i% FOR i% = 0 TO 6: LINE (388, 154 + i%)-(422, 154 + i%), 13: NEXT i% FOR i% = 0 TO 6: LINE (232 + i%, 181)-(232 + i%, 270), 13: NEXT i% FOR i% = 0 TO 6: LINE (215, 270 + i%)-(260, 270 + i%), 13: NEXT i% FOR i% = 0 TO (260 - 230) \ 2: LINE (231 - i%, 181 + i%)-(231 - i%, 211 - i%), 13: NEXT i% FOR i% = 1 TO 10 SLEEP 1 SCREEN 9, , 0, 1 SLEEP 1 SCREEN 9, , 1, 0 NEXT SCREEN 9, , 0, 0 COLOR 11: LOCATE 24, 24: PRINT "Hit any key to see an animation!"; DO: LOOP UNTIL INKEY$ <> "" SCREEN 9, , 0, 1 CLS SCREEN 9, , 1, 0 CLS ActivePAGE = 0 'All screen write commands will goto Page value 0 VisualPAGE = 1 'The page to be viewed is Page value of 1 SCREEN 9, , ActivePAGE, VisualPAGE '(Makes the above true) ' We are now looking at Page1 while working on Page0 CIRCLE (99, 155), 10, 13, 5.85, 2.8 CIRCLE (149, 175), 11, 13, 5.85, 2.8 CIRCLE (99, 157), 7, 13 CIRCLE (150, 175), 7, 13 DRAW "TA335 bu7 br12 R16 U5 TA124 R20 TA155 R24 U5 R20 D6 R10" DRAW "F3 R24 U8 r10 u12 L14 BL20 U3 L35 ND3 BL21 Nd4 L12 d3 TA0" CIRCLE (99 + 12, 140 + 41), 60, 9, .6, 1.2 PSET (99 - 12, 150 - 15), 13 DRAW "BU18 M+22,+10 F14 M+4,-3 M+6,+3 M-6,+12" FOR y = 150 - 35 TO 150 - 23 STEP 6 CIRCLE (99 - 14, y + 5), 4, 13, 4.8, 1 NEXT y CIRCLE (99 + 18, 150 - 2), 3, 13 CIRCLE (99 + 36, 150), 6, 13 GET (60, 100)-(200, 190), Image(0) 'save batcar image
FOR n = 0 TO 250 STEP 2 LOCATE 1, 1: FOR e = 1 TO 24: PRINT SPACE$(80); : NEXT COLOR 14: LOCATE 2, 26: PRINT "Animation using Page Flipping" PUT (1.5 * n, n), Image(0) SWAP ActivePAGE, VisualPAGE ' <-- NOW YOU SEE HOW SCREEN 9, , ActivePAGE, VisualPAGE ' <-- THIS WORKS WAIT &H3DA, 8 '(may need these commands on some systems) WAIT &H3DA, 8, 8 NEXT SCREEN 9, , 0, 0 LOCATE 4, 1: COLOR 10: PRINT " The image did not flicker! You can use page flipping in screens 7, 8, & 9" PRINT " A value of 1 determines the page that is visible while value 0 is redrawn." PRINT COLOR 15: PRINT " DEFINT A-Z " PRINT " ActivePAGE = 0 'All screen write commands will goto Page value 0" PRINT " VisualPAGE = 1 'The page to be viewed is Page value 1" PRINT " SCREEN 9, , ActivePAGE, VisualPAGE ' start in SCREEN 9, , 0, 1" PRINT " DIM SHARED Image(25601) " PRINT " GOSUB Initiate 'DRAW image and GET image procedure" PRINT " FOR n = 0 TO 250 STEP 2 'animation loop" PRINT " LOCATE 1, 1: FOR e = 1 TO 24: PRINT SPACE$(80);: NEXT 'erase screen" PRINT " PUT (1.5 * n, n), Image(0) 'PUT image" COLOR 11: PRINT " SWAP ActivePAGE, VisualPAGE 'Swap page values" PRINT " SCREEN 9, , ActivePAGE, VisualPAGE 'SCREEN 9, , 1, 0 then 9, , 0, 1" COLOR 15: PRINT " NEXT" COLOR 11: LOCATE 24, 28: PRINT " Hit any key to quit!"; DO: LOOP UNTIL INKEY$ <> ""
'The above code was adapted from Bob Seguin's Rocket Program that Pete also blew up LOL. I added his batmobile too!
'You can do the same thing in screen 7 with similar results. Screen 7 is the same size as 13 and allows page flipping too.
'Ted
This message has been edited by burger2227 from IP address 71.60.226.47 on Apr 21, 2008 9:18 PM This message has been edited by burger2227 from IP address 71.60.226.47 on Apr 21, 2008 9:11 PM
This is an updated version of our game. With better sprites. We are having trouble figuring out the spots where to page flip!
DEFINT A-Z
SCREEN 13
CONST MAXBULLETS = 16
AMBX = 199
DIM bullets(MAXBULLETS - 1, 1) AS INTEGER
DIM a(30, 30)'pixel array -- make it bigger for a bigger sprite
delay% = 8
RESTORE shooterdata
FOR J = 0 TO 30
FOR I = 0 TO 30
READ a(I, J)
NEXT
NEXT
RESTORE blooddata
FOR y = 0 TO 9
FOR x = 0 TO 8
READ blood
PSET (x, y), blood
NEXT x
NEXT y
DIM blood%(90)
GET (0, 0)-(9, 10), blood%
FOR y = 0 TO 9
FOR x = 0 TO 8
READ needle
PSET (x, y), needle
NEXT x
NEXT y
DIM needle%(90)
GET (0, 0)-(9, 10), needle%
FOR y = 0 TO 9
FOR x = 0 TO 8
READ cross
PSET (x, y), cross
NEXT x
NEXT y
DIM cross%(90)
GET (0, 0)-(9, 10), cross%
FOR y = 0 TO 9
FOR x = 0 TO 17
READ barrier
PSET (x, y), barrier
NEXT x
NEXT y
DIM barrier%(153)
GET (0, 0)-(17, 10), barrier%
CLS
ex = -24: REM start 24 spaces to the left
inc = 2
DO
GOSUB drawenemies
IF ex = 48 OR ex = -24 AND inc < 0 THEN ey = ey + 2: inc = -inc
ex = ex + inc
IF ey = 66 THEN STOP: REM hits base
GOSUB delay
CLS
GOSUB redrawbase
GOSUB shooter
LOOP
drawenemies:
PUT (ex + 85, ey + 0), needle
PUT (ex + 100, ey + 0), needle
PUT (ex + 115, ey + 0), needle
PUT (ex + 130, ey + 0), needle
PUT (ex + 145, ey + 0), needle
PUT (ex + 160, ey + 0), needle
PUT (ex + 175, ey + 0), needle
PUT (ex + 190, ey + 0), needle
PUT (ex + 205, ey + 0), needle
PUT (ex + 220, ey + 0), needle
PUT (ex + 75, ey + 15), cross
PUT (ex + 90, ey + 15), cross
PUT (ex + 105, ey + 15), cross
PUT (ex + 120, ey + 15), cross
PUT (ex + 135, ey + 15), cross
PUT (ex + 150, ey + 15), cross
PUT (ex + 165, ey + 15), cross
PUT (ex + 180, ey + 15), cross
PUT (ex + 195, ey + 15), cross
PUT (ex + 210, ey + 15), cross
PUT (ex + 85, ey + 30), blood
PUT (ex + 100, ey + 30), blood
PUT (ex + 115, ey + 30), blood
PUT (ex + 130, ey + 30), blood
PUT (ex + 145, ey + 30), blood
PUT (ex + 160, ey + 30), blood
PUT (ex + 175, ey + 30), blood
PUT (ex + 190, ey + 30), blood
PUT (ex + 205, ey + 30), blood
PUT (ex + 220, ey + 30), blood
PUT (ex + 75, ey + 45), needle
PUT (ex + 90, ey + 45), needle
PUT (ex + 105, ey + 45), needle
PUT (ex + 120, ey + 45), needle
PUT (ex + 135, ey + 45), needle
PUT (ex + 150, ey + 45), needle
PUT (ex + 165, ey + 45), needle
PUT (ex + 180, ey + 45), needle
PUT (ex + 195, ey + 45), needle
PUT (ex + 210, ey + 45), needle
PUT (ex + 85, ey + 60), cross
PUT (ex + 100, ey + 60), cross
PUT (ex + 115, ey + 60), cross
PUT (ex + 130, ey + 60), cross
PUT (ex + 145, ey + 60), cross
PUT (ex + 160, ey + 60), cross
PUT (ex + 175, ey + 60), cross
PUT (ex + 190, ey + 60), cross
PUT (ex + 205, ey + 60), cross
PUT (ex + 220, ey + 60), cross
PUT (ex + 75, ey + 75), blood
PUT (ex + 90, ey + 75), blood
PUT (ex + 105, ey + 75), blood
PUT (ex + 120, ey + 75), blood
PUT (ex + 135, ey + 75), blood
PUT (ex + 150, ey + 75), blood
PUT (ex + 165, ey + 75), blood
PUT (ex + 180, ey + 75), blood
PUT (ex + 195, ey + 75), blood
PUT (ex + 210, ey + 75), blood
RETURN
shooter:
'Setup program and data
'Make each slot empty (set both coordinates to -1)
FOR bul = 0 TO UBOUND(bullets, 1)
bullets(bul, 0) = -1
bullets(bul, 1) = -1
NEXT bul
'Main loop
DO
IF OLDAMBX <> AMBX THEN
LINE (OLDAMBX, 150)-(OLDAMBX + 35, 170 + 35), 0, BF
END IF
OLDAMBX = AMBX
'Update objects
'For each bullet
FOR bul = 0 TO UBOUND(bullets, 1)
'If it's not an empty slot
IF NOT (bullets(bul, 0) = -1 AND bullets(bul, 1) = -1) THEN
'Erase the bullet from it's old position
PSET (bullets(bul, 0), bullets(bul, 1)), 0
'Move the bullet up one pixel
bullets(bul, 1) = bullets(bul, 1) - 1
'If it's off the screen, make it an empty slot again
IF bullets(bul, 1) < 0 THEN
bullets(bul, 0) = -1
bullets(bul, 1) = -1
'Otherwise, draw it in it's new spot
ELSE
'Draw the bullet
PSET (bullets(bul, 0), bullets(bul, 1)), 15
END IF
END IF
NEXT bul
FOR J = 0 TO 30
FOR I = 0 TO 30
PSET (I + AMBX, 170 + J), a(I, J)
NEXT
NEXT
'Get user input
a$ = INKEY$
IF a$ <> "" THEN
REM allows a redraw even when key is held down
nodelay = 1
switchvar = switchvar + 1: IF switchvar > 1 THEN switchvar = 0: a$ = "": nodelay = 0
END IF
SELECT CASE a$
'Fire a bullet
CASE CHR$(32)
FOR bul = 0 TO UBOUND(bullets, 1)
'Create a new bullet if it's an empty slot
IF (bullets(bul, 0) = -1 AND bullets(bul, 1) = -1) THEN
bullets(bul, 0) = INT(AMBX + 9)
bullets(bul, 1) = 170
EXIT FOR
END IF
NEXT bul
CASE CHR$(27)
SYSTEM
CASE CHR$(0) + CHR$(75)
5 IF AMBX > 0 THEN AMBX = AMBX - 5
CASE CHR$(0) + CHR$(77)
IF AMBX < 320 THEN AMBX = AMBX + 5
CASE "": RETURN
END SELECT
'Delay for 1/10th of a second
''''''''IF switchvar = 0 THEN RETURN
STime! = TIMER
WHILE TIMER - STime! < .01: WEND
LOOP
'End program
RETURN
redrawbase:
'***PUT***
CLS
PUT (75, 150), barrier
PUT (125, 150), barrier
PUT (175, 150), barrier
PUT (225, 150), barrier
RETURN
delay:
IF nodelay = 1 THEN nodelay = 0: RETURN
FOR Reps% = 1 TO delay%
WAIT &H3DA, 8
WAIT &H3DA, 8, 8
NEXT Reps%
RETURN
shooterdata:
DATA 00,00,00,00,00,00,00,00,00,04,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,04,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,15,00,00,04,00,04,00,04,00,00,15,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,15,15,00,04,15,04,15,04,00,15,15,00,00,00,14,04,14,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,15,15,15,04,04,04,04,04,15,15,15,00,00,00,04,14,04,00,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,00,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,03,17,03,15,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,03,17,03,15,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,03,17,17,15,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,03,17,03,15,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,15,15,15,15,04,14,00,00,00
DATA 00,15,15,04,04,04,04,04,04,04,04,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,14,04,14,00,00
DATA 00,15,15,04,04,04,04,04,04,04,04,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,04,14,04,00,00
DATA 00,15,15,04,04,04,04,04,04,04,04,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,14,04,14,00,00
DATA 00,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,08,08,08,00,00
DATA 00,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,08,08,00,00
DATA 00,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,08,08,08,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,08,08,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,15,15,15,15,08,08,08,00,00
DATA 00,15,15,15,17,17,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,17,17,15,15,15,00,00
DATA 08,06,06,17,08,08,17,06,06,06,06,06,06,06,06,06,06,06,06,06,06,04,06,17,08,08,17,06,00,00,00
DATA 08,15,17,08,08,08,08,17,15,15,15,15,15,15,15,15,15,15,15,15,15,15,17,08,08,08,08,17,00,00,00
DATA 00,00,00,08,08,08,08,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,08,08,08,08,00,00,00,00
DATA 00,00,00,00,08,08,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,08,08,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
'**BLOOD**
blooddata:
DATA 17,17,17,17,04,17,17,17,17
DATA 17,17,17,04,04,04,17,17,17
DATA 17,17,04,04,04,04,04,17,17
DATA 17,04,04,04,04,04,04,04,17
DATA 04,04,04,04,04,04,04,04,04
DATA 04,04,04,04,04,04,04,04,04
DATA 04,04,04,04,04,04,04,04,04
DATA 04,04,04,04,04,04,04,04,04
DATA 17,04,04,04,04,04,04,04,17
DATA 17,17,17,04,04,04,17,17,17
'**NEEDLE**
needledata:
DATA 00,00,00,00,00,00,00,00,15
DATA 00,00,00,00,15,00,15,15,00
DATA 00,00,00,00,00,15,04,15,00
DATA 00,00,00,00,15,04,15,00,00
DATA 00,15,00,15,04,15,00,15,00
DATA 00,00,15,04,15,00,00,00,00
DATA 00,00,04,15,00,00,00,00,00
DATA 00,04,00,00,15,00,00,00,00
DATA 04,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00
'**CROSS**
crossdata:
DATA 15,15,15,15,15,15,15,15,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,04,04,04,04,04,04,04,15
DATA 15,04,04,04,04,04,04,04,15
DATA 15,04,04,04,04,04,04,04,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,15,15,15,15,15,15,15,15
'*** Barrier
barrierdata:
DATA 00,00,08,08,08,08,08,08,08,08,08,08,08,08,08,08,00,00
DATA 00,08,02,67,02,67,02,67,08,67,02,67,08,67,02,67,08,00
DATA 08,02,67,02,67,08,67,02,67,02,67,02,67,02,67,08,67,08
DATA 08,67,08,67,02,67,08,67,02,67,08,67,02,67,02,67,02,08
DATA 08,02,67,08,67,02,67,08,08,08,08,02,67,08,67,02,67,08
DATA 08,67,02,67,02,67,08,00,00,00,00,08,02,67,02,67,02,08
DATA 08,02,67,02,67,08,00,00,00,00,00,00,08,02,67,08,67,08
DATA 08,67,08,67,08,00,00,00,00,00,00,00,00,08,02,67,02,08
DATA 08,02,67,02,08,00,00,00,15,15,00,00,00,08,67,02,67,08
DATA 08,08,08,08,00,00,00,15,15,15,15,00,00,00,08,08,08,08
PUT Blood, needle, cross Sprites on first page. This page will be updated with the movements each time while barriers are visible.
SCREEN 7, , 1, 0
PUT your barriers on second page. These only need to be done once as shooting through them will weaken the barriers.
You can use the SWAP method shown for SCREEN 9 to trade the values, but the first page must be redone each time. After that, the first page is the only one updated.
You can set a page and never change it as my demo showed at the beginning.
Ok I took out the screen 13 at the top and then at the bottom where you told me to I inserted the screens. But it doesn't seem to help. The page is still flickering and I can't get the bullet to shoot! Any solutions?
This is the what I did to try and help fix it, I probably did it wrong!
'**BLOOD**
blooddata:
SCREEN 7, , 0, 1
DATA 17,17,17,17,04,17,17,17,17
DATA 17,17,17,04,04,04,17,17,17
DATA 17,17,04,04,04,04,04,17,17
DATA 17,04,04,04,04,04,04,04,17
DATA 04,04,04,04,04,04,04,04,04
DATA 04,04,04,04,04,04,04,04,04
DATA 04,04,04,04,04,04,04,04,04
DATA 04,04,04,04,04,04,04,04,04
DATA 17,04,04,04,04,04,04,04,17
DATA 17,17,17,04,04,04,17,17,17
'**NEEDLE**
needledata:
SCREEN 7, , 0, 1
DATA 00,00,00,00,00,00,00,00,15
DATA 00,00,00,00,15,00,15,15,00
DATA 00,00,00,00,00,15,04,15,00
DATA 00,00,00,00,15,04,15,00,00
DATA 00,15,00,15,04,15,00,15,00
DATA 00,00,15,04,15,00,00,00,00
DATA 00,00,04,15,00,00,00,00,00
DATA 00,04,00,00,15,00,00,00,00
DATA 04,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00
'**CROSS**
crossdata:
SCREEN 7, , 0, 1
DATA 15,15,15,15,15,15,15,15,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,04,04,04,04,04,04,04,15
DATA 15,04,04,04,04,04,04,04,15
DATA 15,04,04,04,04,04,04,04,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,15,15,15,15,15,15,15,15
'*** Barrier
barrierdata:
SCREEN 7, , 1, 0
DATA 00,00,00,02,02,02,02,02,02,02,02,02,02,02,02,00,00,00
DATA 00,00,02,02,02,02,02,02,02,02,02,02,02,02,02,02,00,00
DATA 00,02,02,09,09,09,09,09,09,09,09,09,09,09,09,02,02,00
DATA 02,02,02,09,02,02,12,12,12,12,12,12,02,02,09,02,02,00
DATA 02,02,02,09,02,02,12,00,00,00,00,12,02,02,09,02,02,02
DATA 02,02,02,09,02,02,12,00,00,00,00,12,02,02,09,02,02,02
DATA 02,02,02,09,02,02,00,00,00,00,00,00,02,02,09,02,02,02
DATA 02,02,02,09,02,00,00,00,00,00,00,00,00,02,09,02,02,02
DATA 02,02,02,09,00,00,00,00,00,00,00,00,00,00,09,02,02,02
DATA 02,02,02,00,00,00,00,00,00,00,00,00,00,00,00,02,02,02
You make the original sprite in a DATA statement and GET it to an array.
Then you PUT the things on the pages! A page value of zero is altered while a page of 1 is visible. I don't think you understand the concept, but keep trying. The only reason to need a page is to set up the screen for that page.
Also you may need a vertical retrace delay, which has already been explained. Look at my demo code. You can make the delay a little longer if need be.
This is just the beginning of how to make a game. Next you will have to figure out if the bullets hit anything or the aliens do. Take your time because I think you can do this!
Like I have been working on this part forever and still can't get it to wrok properly. I hate to ask this cause I feel like I'm getting others to do my work, But I am not understanding this properly. Could you please help with this part!
CONST MAXBULLETS = 16
AMBX = 199
DIM bullets(MAXBULLETS - 1, 1) AS INTEGER
DIM a(30, 30)'pixel array -- make it bigger for a bigger sprite
delay% = 8
RESTORE shooterdata
FOR J = 0 TO 30
FOR I = 0 TO 30
READ a(I, J)
NEXT
NEXT
RESTORE blooddata
FOR y = 0 TO 9
FOR x = 0 TO 8
READ blood
PSET (x, y), blood
NEXT x
NEXT y
DIM blood%(90)
GET (0, 0)-(9, 10), blood%
FOR y = 0 TO 9
FOR x = 0 TO 8
READ needle
PSET (x, y), needle
NEXT x
NEXT y
DIM needle%(90)
GET (0, 0)-(9, 10), needle%
FOR y = 0 TO 9
FOR x = 0 TO 8
READ cross
PSET (x, y), cross
NEXT x
NEXT y
DIM cross%(90)
GET (0, 0)-(9, 10), cross%
FOR y = 0 TO 9
FOR x = 0 TO 17
READ barrier
PSET (x, y), barrier
NEXT x
NEXT y
DIM barrier%(153)
GET (0, 0)-(17, 10), barrier%
CLS
ex = -24: REM start 24 spaces to the left
inc = 2
DO
GOSUB drawenemies
IF ex = 48 OR ex = -24 AND inc < 0 THEN ey = ey + 2: inc = -inc
ex = ex + inc
IF ey = 66 THEN STOP: REM hits base
GOSUB delay
CLS
GOSUB redrawbase
GOSUB shooter
LOOP
drawenemies:
PUT (ex + 85, ey + 0), needle
PUT (ex + 100, ey + 0), needle
PUT (ex + 115, ey + 0), needle
PUT (ex + 130, ey + 0), needle
PUT (ex + 145, ey + 0), needle
PUT (ex + 160, ey + 0), needle
PUT (ex + 175, ey + 0), needle
PUT (ex + 190, ey + 0), needle
PUT (ex + 205, ey + 0), needle
PUT (ex + 220, ey + 0), needle
PUT (ex + 75, ey + 15), cross
PUT (ex + 90, ey + 15), cross
PUT (ex + 105, ey + 15), cross
PUT (ex + 120, ey + 15), cross
PUT (ex + 135, ey + 15), cross
PUT (ex + 150, ey + 15), cross
PUT (ex + 165, ey + 15), cross
PUT (ex + 180, ey + 15), cross
PUT (ex + 195, ey + 15), cross
PUT (ex + 210, ey + 15), cross
PUT (ex + 85, ey + 30), blood
PUT (ex + 100, ey + 30), blood
PUT (ex + 115, ey + 30), blood
PUT (ex + 130, ey + 30), blood
PUT (ex + 145, ey + 30), blood
PUT (ex + 160, ey + 30), blood
PUT (ex + 175, ey + 30), blood
PUT (ex + 190, ey + 30), blood
PUT (ex + 205, ey + 30), blood
PUT (ex + 220, ey + 30), blood
PUT (ex + 75, ey + 45), needle
PUT (ex + 90, ey + 45), needle
PUT (ex + 105, ey + 45), needle
PUT (ex + 120, ey + 45), needle
PUT (ex + 135, ey + 45), needle
PUT (ex + 150, ey + 45), needle
PUT (ex + 165, ey + 45), needle
PUT (ex + 180, ey + 45), needle
PUT (ex + 195, ey + 45), needle
PUT (ex + 210, ey + 45), needle
PUT (ex + 85, ey + 60), cross
PUT (ex + 100, ey + 60), cross
PUT (ex + 115, ey + 60), cross
PUT (ex + 130, ey + 60), cross
PUT (ex + 145, ey + 60), cross
PUT (ex + 160, ey + 60), cross
PUT (ex + 175, ey + 60), cross
PUT (ex + 190, ey + 60), cross
PUT (ex + 205, ey + 60), cross
PUT (ex + 220, ey + 60), cross
PUT (ex + 75, ey + 75), blood
PUT (ex + 90, ey + 75), blood
PUT (ex + 105, ey + 75), blood
PUT (ex + 120, ey + 75), blood
PUT (ex + 135, ey + 75), blood
PUT (ex + 150, ey + 75), blood
PUT (ex + 165, ey + 75), blood
PUT (ex + 180, ey + 75), blood
PUT (ex + 195, ey + 75), blood
PUT (ex + 210, ey + 75), blood
PCOPY 1, 0
RETURN
shooter:
'Setup program and data
'Make each slot empty (set both coordinates to -1)
FOR bul = 0 TO UBOUND(bullets, 1)
bullets(bul, 0) = -1
bullets(bul, 1) = -1
NEXT bul
'Main loop
DO
IF OLDAMBX <> AMBX THEN
LINE (OLDAMBX, 150)-(OLDAMBX + 35, 170 + 35), 0, BF
END IF
OLDAMBX = AMBX
'Update objects
'For each bullet
FOR bul = 0 TO UBOUND(bullets, 1)
'If it's not an empty slot
IF NOT (bullets(bul, 0) = -1 AND bullets(bul, 1) = -1) THEN
'Erase the bullet from it's old position
PSET (bullets(bul, 0), bullets(bul, 1)), 0
'Move the bullet up one pixel
bullets(bul, 1) = bullets(bul, 1) - 1
'If it's off the screen, make it an empty slot again
IF bullets(bul, 1) < 0 THEN
bullets(bul, 0) = -1
bullets(bul, 1) = -1
'Otherwise, draw it in it's new spot
ELSE
'Draw the bullet
PSET (bullets(bul, 0), bullets(bul, 1)), 15
END IF
END IF
NEXT bul
FOR J = 0 TO 30
FOR I = 0 TO 30
PSET (I + AMBX, 170 + J), a(I, J)
NEXT
NEXT
'Get user input
a$ = INKEY$
IF a$ <> "" THEN
REM allows a redraw even when key is held down
nodelay = 1
switchvar = switchvar + 1: IF switchvar > 1 THEN switchvar = 0: a$ = "": nodelay = 0
END IF
SELECT CASE a$
'Fire a bullet
CASE CHR$(32)
FOR bul = 0 TO UBOUND(bullets, 1)
'Create a new bullet if it's an empty slot
IF (bullets(bul, 0) = -1 AND bullets(bul, 1) = -1) THEN
bullets(bul, 0) = INT(AMBX + 9)
bullets(bul, 1) = 170
EXIT FOR
END IF
NEXT bul
CASE CHR$(27)
SYSTEM
CASE CHR$(0) + CHR$(75)
5 IF AMBX > 0 THEN AMBX = AMBX - 5
CASE CHR$(0) + CHR$(77)
IF AMBX < 320 THEN AMBX = AMBX + 5
CASE "": RETURN
END SELECT
'Delay for 1/10th of a second
''''''''IF switchvar = 0 THEN RETURN
STime! = TIMER
WHILE TIMER - STime! < .01: WEND
LOOP
'End program
RETURN
redrawbase:
'***PUT***
CLS
PUT (75, 150), barrier
PUT (125, 150), barrier
PUT (175, 150), barrier
PUT (225, 150), barrier
RETURN
delay:
IF nodelay = 1 THEN nodelay = 0: RETURN
FOR Reps% = 1 TO delay%
WAIT &H3DA, 8
WAIT &H3DA, 8, 8
NEXT Reps%
RETURN
shooterdata:
DATA 00,00,00,00,00,00,00,00,00,04,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,04,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,15,00,00,04,00,04,00,04,00,00,15,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,15,15,00,04,15,04,15,04,00,15,15,00,00,00,14,04,14,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,15,15,15,04,04,04,04,04,15,15,15,00,00,00,04,14,04,00,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,00,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,03,17,03,15,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,03,17,03,15,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,03,17,17,15,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,03,17,03,15,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,15,15,15,15,04,14,00,00,00
DATA 00,15,15,04,04,04,04,04,04,04,04,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,14,04,14,00,00
DATA 00,15,15,04,04,04,04,04,04,04,04,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,04,14,04,00,00
DATA 00,15,15,04,04,04,04,04,04,04,04,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,14,04,14,00,00
DATA 00,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,08,08,08,00,00
DATA 00,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,08,08,00,00
DATA 00,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,08,08,08,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,08,08,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,15,15,15,15,08,08,08,00,00
DATA 00,15,15,15,17,17,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,17,17,15,15,15,00,00
DATA 08,06,06,17,08,08,17,06,06,06,06,06,06,06,06,06,06,06,06,06,06,04,06,17,08,08,17,06,00,00,00
DATA 08,15,17,08,08,08,08,17,15,15,15,15,15,15,15,15,15,15,15,15,15,15,17,08,08,08,08,17,00,00,00
DATA 00,00,00,08,08,08,08,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,08,08,08,08,00,00,00,00
DATA 00,00,00,00,08,08,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,08,08,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
'**BLOOD**
blooddata:
DATA 17,17,17,17,04,17,17,17,17
DATA 17,17,17,04,04,04,17,17,17
DATA 17,17,04,04,04,04,04,17,17
DATA 17,04,04,04,04,04,04,04,17
DATA 04,04,04,04,04,04,04,04,04
DATA 04,04,04,04,04,04,04,04,04
DATA 04,04,04,04,04,04,04,04,04
DATA 04,04,04,04,04,04,04,04,04
DATA 17,04,04,04,04,04,04,04,17
DATA 17,17,17,04,04,04,17,17,17
'**NEEDLE**
needledata:
DATA 00,00,00,00,00,00,00,00,15
DATA 00,00,00,00,15,00,15,15,00
DATA 00,00,00,00,00,15,04,15,00
DATA 00,00,00,00,15,04,15,00,00
DATA 00,15,00,15,04,15,00,15,00
DATA 00,00,15,04,15,00,00,00,00
DATA 00,00,04,15,00,00,00,00,00
DATA 00,04,00,00,15,00,00,00,00
DATA 04,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00
'**CROSS**
crossdata:
DATA 15,15,15,15,15,15,15,15,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,04,04,04,04,04,04,04,15
DATA 15,04,04,04,04,04,04,04,15
DATA 15,04,04,04,04,04,04,04,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,15,15,15,15,15,15,15,15
'*** Barrier
barrierdata:
DATA 00,00,08,08,08,08,08,08,08,08,08,08,08,08,08,08,00,00
DATA 00,08,02,67,02,67,02,67,08,67,02,67,08,67,02,67,08,00
DATA 08,02,67,02,67,08,67,02,67,02,67,02,67,02,67,08,67,08
DATA 08,67,08,67,02,67,08,67,02,67,08,67,02,67,02,67,02,08
DATA 08,02,67,08,67,02,67,08,08,08,08,02,67,08,67,02,67,08
DATA 08,67,02,67,02,67,08,00,00,00,00,08,02,67,02,67,02,08
DATA 08,02,67,02,67,08,00,00,00,00,00,00,08,02,67,08,67,08
DATA 08,67,08,67,08,00,00,00,00,00,00,00,00,08,02,67,02,08
DATA 08,02,67,02,08,00,00,00,15,15,00,00,00,08,67,02,67,08
DATA 08,08,08,08,00,00,00,15,15,15,15,00,00,00,08,08,08,08
Thank you the sketchyness is fixed! now we are going to attack the bullet portion again hah everytime the program redraws the page it erases the bullet so the bullet in turn goes no where.
One of my concerns right now is the constant flashing of the screen. Could this problem be fixed with page flipping or is that what we are already doing?
I'll get to work on solving the bullet!
Ok so we have page flipping in effect. BUT now what?
April 25 2008, 4:07 AM
Ok we have the page flipping thanks to you guys, but the barriers still dissapear as the ambulance travels by, Also We can't figure out how to get the bullet out of the loop so it doesn't dissapear. Suggestins and any help, please?
I will help again as you still have a lot of work to do but
April 25 2008, 10:52 AM
learn what commands do and then keep experimenting.
DEFINT A-Z
SCREEN 7, , 1, 0
CONST MAXBULLETS = 16
AMBX = 199
DIM bullets(MAXBULLETS - 1, 1) AS INTEGER
DIM a(30, 30)'pixel array -- make it bigger for a bigger sprite
delay% = 8
RESTORE shooterdata
FOR J = 0 TO 30
FOR I = 0 TO 30
READ a(I, J)
NEXT
NEXT
RESTORE blooddata
FOR y = 0 TO 9
FOR x = 0 TO 8
READ blood
PSET (x, y), blood
NEXT x
NEXT y
DIM blood(90)
GET (0, 0)-(9, 10), blood
FOR y = 0 TO 9
FOR x = 0 TO 8
READ needle
PSET (x, y), needle
NEXT x
NEXT y
DIM needle(90)
GET (0, 0)-(9, 10), needle
FOR y = 0 TO 9
FOR x = 0 TO 8
READ cross
PSET (x, y), cross
NEXT x
NEXT y
DIM cross(90)
GET (0, 0)-(9, 10), cross
FOR y = 0 TO 9
FOR x = 0 TO 17
READ barrier
PSET (x, y), barrier
NEXT x
NEXT y
DIM barrier(153)
GET (0, 0)-(17, 10), barrier
CLS
ex = -24: REM start 24 spaces to the left
inc = 2
'Make each slot empty (set both coordinates to -1)
FOR bul = 0 TO UBOUND(bullets, 1)
bullets(bul, 0) = -1
bullets(bul, 1) = -1
NEXT bul
'Main loop
DO
GOSUB drawenemies
GOSUB redrawbase
PCOPY 1, 0
CLS
IF OLDAMBX <> AMBX THEN
LINE (OLDAMBX, 150)-(OLDAMBX + 35, 170 + 35), 0, BF
END IF
OLDAMBX = AMBX
'Update objects
'For each bullet
FOR bul = 0 TO UBOUND(bullets, 1)
'If it's not an empty slot
IF NOT (bullets(bul, 0) = -1 AND bullets(bul, 1) = -1) THEN
'Erase the bullet from it's old position
PSET (bullets(bul, 0), bullets(bul, 1)), 0
'Move the bullet up one pixel
bullets(bul, 1) = bullets(bul, 1) - 1
'If it's off the screen, make it an empty slot again
IF bullets(bul, 1) < 0 THEN
bullets(bul, 0) = -1
bullets(bul, 1) = -1
'Otherwise, draw it in it's new spot
ELSE
'Draw the bullet
PSET (bullets(bul, 0), bullets(bul, 1)), 15
END IF
END IF
NEXT bul
FOR J = 0 TO 30
FOR I = 0 TO 30
PSET (I + AMBX, 170 + J), a(I, J)
NEXT
NEXT
'Get user input
a$ = INKEY$
SELECT CASE a$
'Fire a bullet
CASE CHR$(32)
FOR bul = 0 TO UBOUND(bullets, 1)
'Create a new bullet if it's an empty slot
IF (bullets(bul, 0) = -1 AND bullets(bul, 1) = -1) THEN
bullets(bul, 0) = INT(AMBX + 9)
bullets(bul, 1) = 170
EXIT FOR
END IF
NEXT bul
CASE CHR$(27)
EXIT DO
CASE CHR$(0) + CHR$(75)
IF AMBX > 0 THEN AMBX = AMBX - 5
CASE CHR$(0) + CHR$(77)
IF AMBX < 320 THEN AMBX = AMBX + 5
END SELECT
LOOP
'End program
SYSTEM
redrawbase:
'***PUT***
PUT (75, 150), barrier
PUT (125, 150), barrier
PUT (175, 150), barrier
PUT (225, 150), barrier
RETURN
drawenemies:
IF ex = 48 OR ex = -24 AND inc < 0 THEN ey = ey + 2: inc = -inc
ex = ex + inc
IF ey = 66 THEN STOP: REM hits base
PUT (ex + 85, ey + 0), needle
PUT (ex + 100, ey + 0), needle
PUT (ex + 115, ey + 0), needle
PUT (ex + 130, ey + 0), needle
PUT (ex + 145, ey + 0), needle
PUT (ex + 160, ey + 0), needle
PUT (ex + 175, ey + 0), needle
PUT (ex + 190, ey + 0), needle
PUT (ex + 205, ey + 0), needle
PUT (ex + 220, ey + 0), needle
PUT (ex + 75, ey + 15), cross
PUT (ex + 90, ey + 15), cross
PUT (ex + 105, ey + 15), cross
PUT (ex + 120, ey + 15), cross
PUT (ex + 135, ey + 15), cross
PUT (ex + 150, ey + 15), cross
PUT (ex + 165, ey + 15), cross
PUT (ex + 180, ey + 15), cross
PUT (ex + 195, ey + 15), cross
PUT (ex + 210, ey + 15), cross
PUT (ex + 85, ey + 30), blood
PUT (ex + 100, ey + 30), blood
PUT (ex + 115, ey + 30), blood
PUT (ex + 130, ey + 30), blood
PUT (ex + 145, ey + 30), blood
PUT (ex + 160, ey + 30), blood
PUT (ex + 175, ey + 30), blood
PUT (ex + 190, ey + 30), blood
PUT (ex + 205, ey + 30), blood
PUT (ex + 220, ey + 30), blood
PUT (ex + 75, ey + 45), needle
PUT (ex + 90, ey + 45), needle
PUT (ex + 105, ey + 45), needle
PUT (ex + 120, ey + 45), needle
PUT (ex + 135, ey + 45), needle
PUT (ex + 150, ey + 45), needle
PUT (ex + 165, ey + 45), needle
PUT (ex + 180, ey + 45), needle
PUT (ex + 195, ey + 45), needle
PUT (ex + 210, ey + 45), needle
PUT (ex + 85, ey + 60), cross
PUT (ex + 100, ey + 60), cross
PUT (ex + 115, ey + 60), cross
PUT (ex + 130, ey + 60), cross
PUT (ex + 145, ey + 60), cross
PUT (ex + 160, ey + 60), cross
PUT (ex + 175, ey + 60), cross
PUT (ex + 190, ey + 60), cross
PUT (ex + 205, ey + 60), cross
PUT (ex + 220, ey + 60), cross
PUT (ex + 75, ey + 75), blood
PUT (ex + 90, ey + 75), blood
PUT (ex + 105, ey + 75), blood
PUT (ex + 120, ey + 75), blood
PUT (ex + 135, ey + 75), blood
PUT (ex + 150, ey + 75), blood
PUT (ex + 165, ey + 75), blood
PUT (ex + 180, ey + 75), blood
PUT (ex + 195, ey + 75), blood
PUT (ex + 210, ey + 75), blood
RETURN
'**BLOOD**
blooddata:
DATA 17,17,17,17,04,17,17,17,17
DATA 17,17,17,04,04,04,17,17,17
DATA 17,17,04,04,04,04,04,17,17
DATA 17,04,04,04,04,04,04,04,17
DATA 04,04,04,04,04,04,04,04,04
DATA 04,04,04,04,04,04,04,04,04
DATA 04,04,04,04,04,04,04,04,04
DATA 04,04,04,04,04,04,04,04,04
DATA 17,04,04,04,04,04,04,04,17
DATA 17,17,17,04,04,04,17,17,17
'**NEEDLE**
needledata:
DATA 00,00,00,00,00,00,00,00,15
DATA 00,00,00,00,15,00,15,15,00
DATA 00,00,00,00,00,15,04,15,00
DATA 00,00,00,00,15,04,15,00,00
DATA 00,15,00,15,04,15,00,15,00
DATA 00,00,15,04,15,00,00,00,00
DATA 00,00,04,15,00,00,00,00,00
DATA 00,04,00,00,15,00,00,00,00
DATA 04,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00
'**CROSS**
crossdata:
DATA 15,15,15,15,15,15,15,15,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,04,04,04,04,04,04,04,15
DATA 15,04,04,04,04,04,04,04,15
DATA 15,04,04,04,04,04,04,04,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,15,15,15,15,15,15,15,15
'*** Barrier
barrierdata:
DATA 00,00,08,08,08,08,08,08,08,08,08,08,08,08,08,08,00,00
DATA 00,08,02,67,02,67,02,67,08,67,02,67,08,67,02,67,08,00
DATA 08,02,67,02,67,08,67,02,67,02,67,02,67,02,67,08,67,08
DATA 08,67,08,67,02,67,08,67,02,67,08,67,02,67,02,67,02,08
DATA 08,02,67,08,67,02,67,08,08,08,08,02,67,08,67,02,67,08
DATA 08,67,02,67,02,67,08,00,00,00,00,08,02,67,02,67,02,08
DATA 08,02,67,02,67,08,00,00,00,00,00,00,08,02,67,08,67,08
DATA 08,67,08,67,08,00,00,00,00,00,00,00,00,08,02,67,02,08
DATA 08,02,67,02,08,00,00,00,15,15,00,00,00,08,67,02,67,08
DATA 08,08,08,08,00,00,00,15,15,15,15,00,00,00,08,08,08,08
shooterdata:
DATA 00,00,00,00,00,00,00,00,00,04,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,04,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,15,00,00,04,00,04,00,04,00,00,15,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,15,15,00,04,15,04,15,04,00,15,15,00,00,00,14,04,14,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,15,15,15,04,04,04,04,04,15,15,15,00,00,00,04,14,04,00,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,00,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,03,17,03,15,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,03,17,03,15,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,03,17,17,15,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,03,17,03,15,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,15,15,15,15,04,14,00,00,00
DATA 00,15,15,04,04,04,04,04,04,04,04,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,14,04,14,00,00
DATA 00,15,15,04,04,04,04,04,04,04,04,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,04,14,04,00,00
DATA 00,15,15,04,04,04,04,04,04,04,04,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,14,04,14,00,00
DATA 00,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,08,08,08,00,00
DATA 00,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,08,08,00,00
DATA 00,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,08,08,08,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,08,08,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,15,15,15,15,08,08,08,00,00
DATA 00,15,15,15,17,17,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,17,17,15,15,15,00,00
DATA 08,06,06,17,08,08,17,06,06,06,06,06,06,06,06,06,06,06,06,06,06,04,06,17,08,08,17,06,00,00,00
DATA 08,15,17,08,08,08,08,17,15,15,15,15,15,15,15,15,15,15,15,15,15,15,17,08,08,08,08,17,00,00,00
DATA 00,00,00,08,08,08,08,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,08,08,08,08,00,00,00,00
DATA 00,00,00,00,08,08,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,08,08,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
You can eliminate that CLS under DIM Barrier(153) now.
This is why I wish page flipping was available in screen 12 and 13. It makes the action so much smoother. The delay loops that were needed in the SCREEN 13 example are now not needed.
I am in your debt! Thank you. One question though?
April 28 2008, 6:02 AM
When it comes to concerning the bullets and sprites. What statments am I going to want to be using. IS it IF THEN, and Select case, or I'm not quite sure on this part?
DEFINT A-Z
LOCATE 5, 15
PRINT "Introduction and instructions go here"
PRINT
PRINT TAB(10); " Check out the drawbullet SUB for use of POINT"
PRINT TAB(5); "and the reason for the numbers at top left of screen"
PRINT TAB(5); "See my example of how to avoid firing through barriers"
PRINT TAB(5); "also check out the loop in drawenemies to shorten code"
PRINT TAB(10); "I have marked the important parts thus '*****"
PRINT
PRINT TAB(20); "Press Enter to start"
INPUT k
SCREEN 7, , 1, 0
CONST MAXBULLETS = 16
AMBX = 199
DIM bullets(MAXBULLETS - 1, 1) AS INTEGER
DIM a(30, 30)'pixel array -- make it bigger for a bigger sprite
delay% = 8
RESTORE shooterdata
FOR J = 0 TO 30
FOR i = 0 TO 30
READ a(i, J)
NEXT
NEXT
RESTORE blooddata
FOR y = 0 TO 9
FOR x = 0 TO 8
READ blood
PSET (x, y), blood
NEXT x
NEXT y
DIM blood(90)
GET (0, 0)-(9, 10), blood
FOR y = 0 TO 9
FOR x = 0 TO 8
READ needle
PSET (x, y), needle
NEXT x
NEXT y
DIM needle(90)
GET (0, 0)-(9, 10), needle
FOR y = 0 TO 9
FOR x = 0 TO 8
READ cross
PSET (x, y), cross
NEXT x
NEXT y
DIM cross(90)
GET (0, 0)-(9, 10), cross
FOR y = 0 TO 9
FOR x = 0 TO 17
READ barrier
PSET (x, y), barrier
NEXT x
NEXT y
DIM barrier(153)
GET (0, 0)-(17, 10), barrier
ex = -24: REM start 24 spaces to the left
inc = 2
'Make each slot empty (set both coordinates to -1)
FOR bul = 0 TO UBOUND(bullets, 1)
bullets(bul, 0) = -1
bullets(bul, 1) = -1
NEXT bul
'Main loop
DO
REM By drawing enemies first you can then check by using POINT
' what is happening to your bullet, check top left of screen.
REM Barriers can be avoided by setting the bullet coordinates.
drawbullet:
IF OLDAMBX <> AMBX THEN
LINE (OLDAMBX, 150)-(OLDAMBX + 35, 170 + 35), 0, BF
END IF
OLDAMBX = AMBX
'Update objects
'For each bullet
FOR bul = 0 TO UBOUND(bullets, 1)
'*****
REM Find color that bullet is hitting,check top left of screen
'to see the numbers coming up from each bullet as it strikes
' this can be removed when you understand it
PRINT POINT(bullets(bul, 0), bullets(bul, 1))
REM now create a variable, let us call it dead e.g
' if POINT(as above) > 0 then dead = dead + 1
' now you can make a routine in drawenemies that stops some of the PUTS
' from reaching the screen.
'If it's not an empty slot
IF NOT (bullets(bul, 0) = -1 AND bullets(bul, 1) = -1) THEN
'Erase the bullet from it's old position
PSET (bullets(bul, 0), bullets(bul, 1)), 0
'Move the bullet up one pixel
bullets(bul, 1) = bullets(bul, 1) - 1
'If it's off the screen, make it an empty slot again
IF bullets(bul, 1) < 0 THEN
bullets(bul, 0) = -1
bullets(bul, 1) = -1
'Otherwise, draw it in it's new spot
ELSE
'Draw the bullet
PSET (bullets(bul, 0), bullets(bul, 1)), 15
END IF
END IF
NEXT bul
FOR J = 0 TO 30
FOR i = 0 TO 30
PSET (i + AMBX, 170 + J), a(i, J)
NEXT
NEXT
'Get user input
a$ = INKEY$
SELECT CASE a$
'Fire a bullet
CASE CHR$(32)
FOR bul = 0 TO UBOUND(bullets, 1)
'*****
REM Avoid firing through barriers like this example for first barrier
IF AMBX > 66 AND AMBX < 83 THEN EXIT FOR
'Create a new bullet if it's an empty slot
IF (bullets(bul, 0) = -1 AND bullets(bul, 1) = -1) THEN
bullets(bul, 0) = INT(AMBX + 9)
bullets(bul, 1) = 170
EXIT FOR
END IF
NEXT bul
CASE CHR$(27)
SYSTEM
CASE CHR$(0) + CHR$(75)
IF AMBX > 0 THEN AMBX = AMBX - 5
CASE CHR$(0) + CHR$(77)
IF AMBX < 320 THEN AMBX = AMBX + 5
END SELECT
RETURN
'End program
SYSTEM
redrawbase:
'***PUT***
PUT (75, 150), barrier
PUT (125, 150), barrier
PUT (175, 150), barrier
PUT (225, 150), barrier
RETURN
drawenemies:
IF ex = 48 OR ex = -24 AND inc < 0 THEN ey = ey + 2: inc = -inc
ex = ex + inc
IF ey = 66 THEN STOP: REM hits base
PUT (ex + 85, ey + 0), needle
PUT (ex + 100, ey + 0), needle
PUT (ex + 115, ey + 0), needle
PUT (ex + 130, ey + 0), needle
PUT (ex + 145, ey + 0), needle
PUT (ex + 160, ey + 0), needle
PUT (ex + 175, ey + 0), needle
PUT (ex + 190, ey + 0), needle
PUT (ex + 205, ey + 0), needle
PUT (ex + 220, ey + 0), needle
PUT (ex + 75, ey + 15), cross
PUT (ex + 90, ey + 15), cross
PUT (ex + 105, ey + 15), cross
PUT (ex + 120, ey + 15), cross
PUT (ex + 135, ey + 15), cross
PUT (ex + 150, ey + 15), cross
PUT (ex + 165, ey + 15), cross
PUT (ex + 180, ey + 15), cross
PUT (ex + 195, ey + 15), cross
PUT (ex + 210, ey + 15), cross
PUT (ex + 85, ey + 30), blood
PUT (ex + 100, ey + 30), blood
PUT (ex + 115, ey + 30), blood
PUT (ex + 130, ey + 30), blood
PUT (ex + 145, ey + 30), blood
PUT (ex + 160, ey + 30), blood
PUT (ex + 175, ey + 30), blood
PUT (ex + 190, ey + 30), blood
PUT (ex + 205, ey + 30), blood
PUT (ex + 220, ey + 30), blood
PUT (ex + 75, ey + 45), needle
PUT (ex + 90, ey + 45), needle
PUT (ex + 105, ey + 45), needle
PUT (ex + 120, ey + 45), needle
PUT (ex + 135, ey + 45), needle
PUT (ex + 150, ey + 45), needle
PUT (ex + 165, ey + 45), needle
PUT (ex + 180, ey + 45), needle
PUT (ex + 195, ey + 45), needle
PUT (ex + 210, ey + 45), needle
PUT (ex + 85, ey + 60), cross
PUT (ex + 100, ey + 60), cross
PUT (ex + 115, ey + 60), cross
PUT (ex + 130, ey + 60), cross
PUT (ex + 145, ey + 60), cross
PUT (ex + 160, ey + 60), cross
PUT (ex + 175, ey + 60), cross
PUT (ex + 190, ey + 60), cross
PUT (ex + 205, ey + 60), cross
PUT (ex + 220, ey + 60), cross
REM Example of how to shorten code but do not erase lines yet
' as they may come in handy when you destroy enemy
'PUT (ex + 75, ey + 75), blood
'PUT (ex + 90, ey + 75), blood
'PUT (ex + 105, ey + 75), blood
'PUT (ex + 120, ey + 75), blood
'PUT (ex + 135, ey + 75), blood
'PUT (ex + 150, ey + 75), blood
'PUT (ex + 165, ey + 75), blood
'PUT (ex + 180, ey + 75), blood
'PUT (ex + 195, ey + 75), blood
'PUT (ex + 210, ey + 75), blood
FOR i = 75 TO 210 STEP 15
PUT (ex + i, ey + 75), blood
NEXT
RETURN
'**BLOOD**
blooddata:
DATA 17,17,17,17,04,17,17,17,17
DATA 17,17,17,04,04,04,17,17,17
DATA 17,17,04,04,04,04,04,17,17
DATA 17,04,04,04,04,04,04,04,17
DATA 04,04,04,04,04,04,04,04,04
DATA 04,04,04,04,04,04,04,04,04
DATA 04,04,04,04,04,04,04,04,04
DATA 04,04,04,04,04,04,04,04,04
DATA 17,04,04,04,04,04,04,04,17
DATA 17,17,17,04,04,04,17,17,17
'**NEEDLE**
needledata:
DATA 00,00,00,00,00,00,00,00,15
DATA 00,00,00,00,15,00,15,15,00
DATA 00,00,00,00,00,15,04,15,00
DATA 00,00,00,00,15,04,15,00,00
DATA 00,15,00,15,04,15,00,15,00
DATA 00,00,15,04,15,00,00,00,00
DATA 00,00,04,15,00,00,00,00,00
DATA 00,04,00,00,15,00,00,00,00
DATA 04,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00
'**CROSS**
crossdata:
DATA 15,15,15,15,15,15,15,15,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,04,04,04,04,04,04,04,15
DATA 15,04,04,04,04,04,04,04,15
DATA 15,04,04,04,04,04,04,04,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,15,15,15,15,15,15,15,15
'*** Barrier
barrierdata:
DATA 00,00,08,08,08,08,08,08,08,08,08,08,08,08,08,08,00,00
DATA 00,08,02,67,02,67,02,67,08,67,02,67,08,67,02,67,08,00
DATA 08,02,67,02,67,08,67,02,67,02,67,02,67,02,67,08,67,08
DATA 08,67,08,67,02,67,08,67,02,67,08,67,02,67,02,67,02,08
DATA 08,02,67,08,67,02,67,08,08,08,08,02,67,08,67,02,67,08
DATA 08,67,02,67,02,67,08,00,00,00,00,08,02,67,02,67,02,08
DATA 08,02,67,02,67,08,00,00,00,00,00,00,08,02,67,08,67,08
DATA 08,67,08,67,08,00,00,00,00,00,00,00,00,08,02,67,02,08
DATA 08,02,67,02,08,00,00,00,15,15,00,00,00,08,67,02,67,08
DATA 08,08,08,08,00,00,00,15,15,15,15,00,00,00,08,08,08,08
shooterdata:
DATA 00,00,00,00,00,00,00,00,00,04,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,04,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,15,00,00,04,00,04,00,04,00,00,15,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,15,15,00,04,15,04,15,04,00,15,15,00,00,00,14,04,14,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,15,15,15,04,04,04,04,04,15,15,15,00,00,00,04,14,04,00,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,00,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,03,17,03,15,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,03,17,03,15,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,03,17,17,15,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,03,17,03,15,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,15,15,15,15,04,14,00,00,00
DATA 00,15,15,04,04,04,04,04,04,04,04,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,14,04,14,00,00
DATA 00,15,15,04,04,04,04,04,04,04,04,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,04,14,04,00,00
DATA 00,15,15,04,04,04,04,04,04,04,04,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,14,04,14,00,00
DATA 00,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,08,08,08,00,00
DATA 00,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,08,08,00,00
DATA 00,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,08,08,08,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,08,08,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,15,15,15,15,08,08,08,00,00
DATA 00,15,15,15,17,17,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,17,17,15,15,15,00,00
DATA 08,06,06,17,08,08,17,06,06,06,06,06,06,06,06,06,06,06,06,06,06,04,06,17,08,08,17,06,00,00,00
DATA 08,15,17,08,08,08,08,17,15,15,15,15,15,15,15,15,15,15,15,15,15,15,17,08,08,08,08,17,00,00,00
DATA 00,00,00,08,08,08,08,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,08,08,08,08,00,00,00,00
DATA 00,00,00,00,08,08,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,08,08,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DEFINT A-Z
CLS
LOCATE 4, 14
PRINT " Press spacebar to fire at enemy"
PRINT
PRINT TAB(15); "Use arrow keys to move ambulance"
PRINT
PRINT TAB(10); "If a needle gets close to your barriers "
PRINT TAB(17); "then you will be destroyed"
PRINT
PRINT TAB(9); "Needles will need to be hit more than once"
PRINT
PRINT TAB(20); "Press Enter to start"
INPUT k
SCREEN 7, , 1, 0
CONST MAXBULLETS = 16
AMBX = 199
DIM bullets(MAXBULLETS - 1, 1) AS INTEGER
DIM a(30, 30)'pixel array -- make it bigger for a bigger sprite
RESTORE shooterdata
FOR j = 0 TO 30
FOR i = 0 TO 30
READ a(i, j)
NEXT
NEXT
RESTORE blooddata
FOR y = 0 TO 9
FOR x = 0 TO 8
READ blood
PSET (x, y), blood
NEXT x
NEXT y
DIM blood(90)
GET (0, 0)-(9, 10), blood
FOR y = 0 TO 9
FOR x = 0 TO 8
READ needle
PSET (x, y), needle
NEXT x
NEXT y
DIM needle(90)
GET (0, 0)-(9, 10), needle
FOR y = 0 TO 9
FOR x = 0 TO 8
READ cross
PSET (x, y), cross
NEXT x
NEXT y
DIM cross(90)
GET (0, 0)-(9, 10), cross
FOR y = 0 TO 9
FOR x = 0 TO 17
READ barrier
PSET (x, y), barrier
NEXT x
NEXT y
DIM barrier(153)
GET (0, 0)-(17, 10), barrier
ex = -24: REM start 24 spaces to the left
inc = 2
'Make each slot empty (set both coordinates to -1)
FOR bul = 0 TO UBOUND(bullets, 1)
bullets(bul, 0) = -1
bullets(bul, 1) = -1
NEXT bul
REM flip page
PCOPY 1, 0
REM clear original page
CLS
LOOP
drawbullet:
IF OLDAMBX <> AMBX THEN
LINE (OLDAMBX, 150)-(OLDAMBX + 35, 170 + 35), 0, BF
END IF
OLDAMBX = AMBX
'Update objects
'For each bullet
FOR bul = 0 TO UBOUND(bullets, 1)
IF POINT(bullets(bul, 0), bullets(bul, 1)) > 0 THEN
REM this is very crude but it will serve the purpose
IF AMBX > 150 THEN dead = dead + 1 ELSE dead1 = dead1 + 1
REM This kills the bullet after it strikes
bullets(bul, 0) = -1: bullets(bul, 1) = -1
' now you can make a routine in drawenemies that stops some of the PUTS
END IF
'If it's not an empty slot
IF NOT (bullets(bul, 0) = -1 AND bullets(bul, 1) = -1) THEN
'Erase the bullet from it's old position
PSET (bullets(bul, 0), bullets(bul, 1)), 0
'Move the bullet up one pixel
bullets(bul, 1) = bullets(bul, 1) - 1
'If it's off the screen, make it an empty slot again
IF bullets(bul, 1) < 0 THEN
bullets(bul, 0) = -1
bullets(bul, 1) = -1
'Otherwise, draw it in it's new spot
ELSE
'Draw the bullet
PSET (bullets(bul, 0), bullets(bul, 1)), 15
END IF
END IF
NEXT bul
FOR j = 0 TO 30
FOR i = 0 TO 30
PSET (i + AMBX, 170 + j), a(i, j)
NEXT
NEXT
'Get user input
a$ = INKEY$
SELECT CASE a$
'Fire a bullet
CASE CHR$(32)
FOR bul = 0 TO UBOUND(bullets, 1)
REM Avoid firing through barriers
IF AMBX > 66 AND AMBX < 83 THEN EXIT FOR
IF AMBX > 116 AND AMBX < 133 THEN EXIT FOR
IF AMBX > 166 AND AMBX < 183 THEN EXIT FOR
IF AMBX > 216 AND AMBX < 233 THEN EXIT FOR
'Create a new bullet if it's an empty slot
IF (bullets(bul, 0) = -1 AND bullets(bul, 1) = -1) THEN
bullets(bul, 0) = INT(AMBX + 9)
bullets(bul, 1) = 170
EXIT FOR
END IF
NEXT bul
CASE CHR$(27)
SYSTEM
CASE CHR$(0) + CHR$(75)
IF AMBX > 0 THEN AMBX = AMBX - 5
CASE CHR$(0) + CHR$(77)
IF AMBX < 320 THEN AMBX = AMBX + 5
END SELECT
RETURN
'End program
SYSTEM
redrawbase:
'***PUT***
PUT (75, 150), barrier
PUT (125, 150), barrier
PUT (175, 150), barrier
PUT (225, 150), barrier
RETURN
drawenemies:
IF ex = 48 OR ex = -24 AND inc < 0 THEN ey = ey + 2: inc = -inc
ex = ex + inc
IF ey = 116 THEN
PRINT TAB(5); "You have been destroyed"
PRINT
PRINT "Press Esc to Exit or r to run again"
PCOPY 1, 0
DO
a$ = INKEY$
IF a$ = "r" THEN RUN
IF a$ = CHR$(27) THEN SYSTEM
LOOP
END IF
FOR i = 160 TO 220 - (15 * INT(dead / 12)) STEP 15
PUT (ex + i, ey + 0), needle
NEXT
FOR i = 85 TO 145 - (15 * INT(dead1 / 12)) STEP 15
PUT (ex + i, ey + 0), needle
NEXT
FOR i2 = 150 TO 210 - (15 * INT(dead / 10)) STEP 15
PUT (ex + i2, ey + 15), cross
NEXT
FOR i2 = 75 TO 135 - (15 * INT(dead1 / 10)) STEP 15
PUT (ex + i2, ey + 15), cross
NEXT
FOR i3 = 160 TO 220 - (15 * INT(dead / 8)) STEP 15
PUT (ex + i3, ey + 30), blood
NEXT
FOR i3 = 85 TO 145 - (15 * INT(dead1 / 8)) STEP 15
PUT (ex + i3, ey + 30), blood
NEXT
FOR i4 = 150 TO 210 - (15 * INT(dead / 6)) STEP 15
PUT (ex + i4, ey + 45), needle
NEXT
FOR i4 = 75 TO 135 - (15 * INT(dead1 / 6)) STEP 15
PUT (ex + i4, ey + 45), needle
NEXT
FOR i5 = 160 TO 220 - (15 * INT(dead / 3)) STEP 15
PUT (ex + i5, ey + 60), cross
NEXT
FOR i5 = 85 TO 145 - (15 * INT(dead1 / 3)) STEP 15
PUT (ex + i5, ey + 60), cross
NEXT
FOR i6 = 150 TO 210 - (15 * dead) STEP 15
PUT (ex + i6, ey + 75), blood
NEXT
FOR i6 = 75 TO 135 - (15 * dead1) STEP 15
PUT (ex + i6, ey + 75), blood
NEXT
IF dead >= 60 AND dead1 >= 60 THEN
PRINT TAB(5); "You have saved the ambulance"
PRINT
PRINT "Press Esc to Exit or r to run again"
PCOPY 1, 0
DO
a$ = INKEY$
IF a$ = "r" THEN RUN
IF a$ = CHR$(27) THEN SYSTEM
LOOP
END IF
RETURN
'**BLOOD**
blooddata:
DATA 17,17,17,17,04,17,17,17,17
DATA 17,17,17,04,04,04,17,17,17
DATA 17,17,04,04,04,04,04,17,17
DATA 17,04,04,04,04,04,04,04,17
DATA 04,04,04,04,04,04,04,04,04
DATA 04,04,04,04,04,04,04,04,04
DATA 04,04,04,04,04,04,04,04,04
DATA 04,04,04,04,04,04,04,04,04
DATA 17,04,04,04,04,04,04,04,17
DATA 17,17,17,04,04,04,17,17,17
'**NEEDLE**
needledata:
DATA 00,00,00,00,00,00,00,00,15
DATA 00,00,00,00,15,00,15,15,00
DATA 00,00,00,00,00,15,04,15,00
DATA 00,00,00,00,15,04,15,00,00
DATA 00,15,00,15,04,15,00,15,00
DATA 00,00,15,04,15,00,00,00,00
DATA 00,00,04,15,00,00,00,00,00
DATA 00,04,00,00,15,00,00,00,00
DATA 04,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00
'**CROSS**
crossdata:
DATA 15,15,15,15,15,15,15,15,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,04,04,04,04,04,04,04,15
DATA 15,04,04,04,04,04,04,04,15
DATA 15,04,04,04,04,04,04,04,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,15,15,04,04,04,15,15,15
DATA 15,15,15,15,15,15,15,15,15
'*** Barrier
barrierdata:
DATA 00,00,08,08,08,08,08,08,08,08,08,08,08,08,08,08,00,00
DATA 00,08,02,67,02,67,02,67,08,67,02,67,08,67,02,67,08,00
DATA 08,02,67,02,67,08,67,02,67,02,67,02,67,02,67,08,67,08
DATA 08,67,08,67,02,67,08,67,02,67,08,67,02,67,02,67,02,08
DATA 08,02,67,08,67,02,67,08,08,08,08,02,67,08,67,02,67,08
DATA 08,67,02,67,02,67,08,00,00,00,00,08,02,67,02,67,02,08
DATA 08,02,67,02,67,08,00,00,00,00,00,00,08,02,67,08,67,08
DATA 08,67,08,67,08,00,00,00,00,00,00,00,00,08,02,67,02,08
DATA 08,02,67,02,08,00,00,00,15,15,00,00,00,08,67,02,67,08
DATA 08,08,08,08,00,00,00,15,15,15,15,00,00,00,08,08,08,08
shooterdata:
DATA 00,00,00,00,00,00,00,00,00,04,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,04,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,15,00,00,04,00,04,00,04,00,00,15,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,15,15,00,04,15,04,15,04,00,15,15,00,00,00,14,04,14,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,15,15,15,04,04,04,04,04,15,15,15,00,00,00,04,14,04,00,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,00,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,03,17,03,15,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,03,17,03,15,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,03,17,17,15,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,03,17,03,15,00,00,00,00,00,00,00,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,15,15,15,15,04,14,00,00,00
DATA 00,15,15,04,04,04,04,04,04,04,04,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,14,04,14,00,00
DATA 00,15,15,04,04,04,04,04,04,04,04,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,04,14,04,00,00
DATA 00,15,15,04,04,04,04,04,04,04,04,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,14,04,14,00,00
DATA 00,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,08,08,08,00,00
DATA 00,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,08,08,00,00
DATA 00,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,08,08,08,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,08,08,00,00
DATA 00,15,15,15,15,15,15,04,04,04,04,04,15,15,15,15,15,15,15,15,15,15,15,15,15,15,08,08,08,00,00
DATA 00,15,15,15,17,17,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,17,17,15,15,15,00,00
DATA 08,06,06,17,08,08,17,06,06,06,06,06,06,06,06,06,06,06,06,06,06,04,06,17,08,08,17,06,00,00,00
DATA 08,15,17,08,08,08,08,17,15,15,15,15,15,15,15,15,15,15,15,15,15,15,17,08,08,08,08,17,00,00,00
DATA 00,00,00,08,08,08,08,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,08,08,08,08,00,00,00,00
DATA 00,00,00,00,08,08,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,08,08,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
Re: If you are stuck again, here is a rough example.
May 2 2008, 11:09 AM
I have messed with this for a while now, and i cannot figure out why when you shoot it randomly kills the invaders sometimes it kills the one it comes in contact with and sometimes its completly random. Sorry im just confused
The reason for the discrepancy when hitting the enemy
May 2 2008, 12:31 PM
I based it roughly on AMBX, which changes when you move the ambulance. As I was working with other peoples code my next step was going to be to use POINT but I have now given up on this project. Best of luck, you have learned a lot.
The drawenemies sub example was to show you how to blank out PUTS
May 2 2008, 3:44 PM
This split the destroy enemies into two sides of the screen and needed more hits to destroy the farthest line of enemies.
It was an example that I was going to expand on.
You still need to fine tune it and as you will see the enemies are removed in pairs, all you have to do now is to make it delete one sprite at a time. If you study the drawenemies sub this should be easy for you.
Now you can see why I told you not to get rid of all the PUTS when experimenting.
DEFINT A-Z
CLS
LOCATE 4, 14
PRINT " Press spacebar to fire at enemy"
PRINT
PRINT TAB(15); "Use arrow