'=========================================================================== ' Subject: TARGET PRACTISE Date: 04-05-99 (02:12) ' Author: The ABC Programmer Code: BEC ' Origin: voxel@edmc.net Packet: BASEC.ABC '=========================================================================== ' Target Practise, converted to BASEC v0.15 [DOS] by William Yu 'Variable list for target.bas DIM POINTS% AS INTEGER DIM AMMO% AS INTEGER DIM XPOS% AS INTEGER DIM YPOS% AS INTEGER DIM COL% AS INTEGER DIM ECOL% AS INTEGER DIM EXPOS% AS INTEGER DIM EYPOS% AS INTEGER DIM EDIR% AS INTEGER DIM XMIN% AS INTEGER DIM XMAX% AS INTEGER DIM YMIN% AS INTEGER DIM YMAX% AS INTEGER DIM EXMIN% AS INTEGER DIM EYMIN% AS INTEGER DIM EXMAX% AS INTEGER DIM EYMAX% AS INTEGER DIM I% AS INTEGER DIM KEY$ AS STRING '=========================================================================== ' Subject: SIMPLE TARGET GAME Date: 06-21-98 (02:38) ' Author: Chris Pulley Code: QB, QBasic, PDS ' Origin: beelzebu@swbell.net Packet: DEMOS.ABC '=========================================================================== ' Target Version 1.0 ' ' This is a simple target game it is extremly simple to program and use ' this code is freeware and you may use all or any of the code you want ' as long as you give me (Chris Pulley) some credit ' ' Has a Few Bugs Sometimes the Enemy isn't completly cleared during ' movement and sometimes the ball gets caught in a loop and follows the ' same pattern, adjust the edir% numbers in the enemy control section ' to change the directions ' ' If you can fix it then COOL if not I don't give a fuck, took me 20 minutes ' to program and I have better things to do ' ' The Keys are as follows Have NUM-LOCK on to use keypad ' ' W = UP 8 = UP ' X = DOWN 2 = DOWN ' A = LEFT 4 = LEFT ' S = RIGHT 6 = RIGHT ' Q = UP AND LEFT 7 = UP AND LEFT ' E = UP AND RIGHT 9 = UP AND RIGHT ' Z = DOWN AND LEFT 1 = DOWN AND LEFT ' C = DOWN AND RIGHT 3 = DOWN AND RIGHT ' ' M = FIRE 5 = FIRE ' ' ESCAPE = END ' CLS ' Clear the Screen SCREEN 13 ' 13h 320 X 200 X 256 RANDOMIZE TIMER ' Set Random Numbers points% = 0 ammo% = 1000 ' Set Variables xpos% = 160 ypos% = 100 col% = 4 ecol% = 2 expos% = 100 eypos% = 100 edir% = 4 xmin% = 17 xmax% = 300 ymin% = 17 ymax% = 143 exmin% = 33 eymin% = 20 exmax% = 294 eymax% = 139 LINE (0, 0)-(319, 199), 1, B ' Draw the Game Screen LINE (0, 160)-(319, 160), 1 LOCATE 22, 2: PRINT "AMMO:" LOCATE 22, 25: PRINT "POINTS:" updatescreen: ' Update All IF ammo% = 0 THEN GOTO done1 'sleep .1 ' Update Targeter IF xpos% < xmin% THEN xpos% = xmin% IF xpos% > xmax% THEN xpos% = xmax% IF ypos% < ymin% THEN ypos% = ymin% IF ypos% > ymax% THEN ypos% = ymax% LINE (xpos% - 16, ypos% - 15)-(xpos% + 16, ypos% + 15), 0, BF LINE (xpos%, ypos%)-(xpos% - 11, ypos%), col% LINE (xpos%, ypos%)-(xpos% + 11, ypos%), col% LINE (xpos%, ypos%)-(xpos%, ypos% - 10), col% LINE (xpos%, ypos%)-(xpos%, ypos% + 10), col% CIRCLE (xpos%, ypos%), 7, col% ' Update Enemy LINE (expos% - 20, eypos% - 15)-(expos% + 20, eypos% + 15), 0, BF CIRCLE (expos%, eypos%), 10, ecol% PAINT (expos%, eypos%), ecol%, ecol% ' Update User Variables LOCATE 22, 7: PRINT ammo% LOCATE 22, 32: PRINT points% ' Enemy Control IF edir% = 1 THEN expos% = expos% - 1: eypos% = eypos% - 1 IF expos% < exmin% THEN edir% = 3 IF eypos% < eymin% THEN edir% = 4 IF expos% > exmax% THEN edir% = 2 IF eypos% > eymax% THEN edir% = 1 END IF IF edir% = 2 THEN expos% = expos% + 1: eypos% = eypos% - 1 IF expos% < exmin% THEN edir% = 2 IF eypos% < eymin% THEN edir% = 3 IF expos% > exmax% THEN edir% = 4 IF eypos% > eymax% THEN edir% = 1 END IF IF edir% = 3 THEN expos% = expos% + 1: eypos% = eypos% + 1 IF expos% < exmin% THEN edir% = 3 IF eypos% < eymin% THEN edir% = 4 IF expos% > exmax% THEN edir% = 4 IF eypos% > eymax% THEN edir% = 2 END IF IF edir% = 4 THEN expos% = expos% - 1: eypos% = eypos% + 1 IF expos% < exmin% THEN edir% = 3 IF eypos% < eymin% THEN edir% = 4 IF expos% > exmax% THEN edir% = 1 IF eypos% > eymax% THEN edir% = 1 END IF ' Get User Key key$ = INKEY$ IF key$ = "w" THEN ypos% = ypos% - 5: GOTO updatescreen IF key$ = "8" THEN ypos% = ypos% - 5: GOTO updatescreen IF key$ = "x" THEN ypos% = ypos% + 5: GOTO updatescreen IF key$ = "2" THEN ypos% = ypos% + 5: GOTO updatescreen IF key$ = "a" THEN xpos% = xpos% - 5: GOTO updatescreen IF key$ = "4" THEN xpos% = xpos% - 5: GOTO updatescreen IF key$ = "d" THEN xpos% = xpos% + 5: GOTO updatescreen IF key$ = "6" THEN xpos% = xpos% + 5: GOTO updatescreen IF key$ = "q" THEN xpos% = xpos% - 5: ypos% = ypos% - 5: GOTO updatescreen IF key$ = "7" THEN xpos% = xpos% - 5: ypos% = ypos% - 5: GOTO updatescreen IF key$ = "z" THEN xpos% = xpos% - 5: ypos% = ypos% + 5: GOTO updatescreen IF key$ = "1" THEN xpos% = xpos% - 5: ypos% = ypos% + 5: GOTO updatescreen IF key$ = "e" THEN xpos% = xpos% + 5: ypos% = ypos% - 5: GOTO updatescreen IF key$ = "9" THEN xpos% = xpos% + 5: ypos% = ypos% - 5: GOTO updatescreen IF key$ = "c" THEN xpos% = xpos% + 5: ypos% = ypos% + 5: GOTO updatescreen IF key$ = "3" THEN xpos% = xpos% + 5: ypos% = ypos% + 5: GOTO updatescreen IF key$ = "m" THEN GOTO shoot IF key$ = "5" THEN GOTO shoot IF key$ = CHR$(27) THEN GOTO done GOTO updatescreen shoot: ammo% = ammo% - 2 LINE (100, 159)-(xpos% - 4, ypos%), 2 LINE (220, 159)-(xpos% + 4, ypos%), 2 LINE (100, 159)-(xpos% - 4, ypos%), 0 LINE (220, 159)-(xpos% + 4, ypos%), 0 IF xpos% > expos% THEN IF xpos% > expos% - 15 THEN IF xpos% < expos% + 15 THEN IF ypos% > eypos% - 15 THEN IF ypos% < eypos% + 15 THEN GOTO newenemy END IF END IF END IF END IF GOTO updatescreen newenemy: ammo% = ammo% + 500 points% = points% + 1000 LINE (expos% - 15, eypos% - 15)-(expos% + 15, eypos% + 15), 0, BF expos% = INT(RND * 300) eypos% = INT(RND * 139) IF expos% < exmin% THEN GOTO newenemy IF eypos% < eymin% THEN GOTO newenemy GOTO updatescreen done1: CLS PRINT "GAME OVER: AMMO DEPLETED": PRINT PRINT "FINAL POINTS: ", points% SLEEP done: