ProgramList K3Y

ProgramList K3Y

K3Y
K3Y

May 15th, 2007, 11:02 pm #1

ProgramList K3Y
Last edited by iorr5t on May 18th, 2007, 8:52 pm, edited 1 time in total.
Quote
Share

K3Y
Joined: May 15th, 2007, 11:02 pm

May 15th, 2007, 11:09 pm #2

DECLARE SUB drawworld ()
DECLARE SUB menu ()
DECLARE SUB stats ()
COMMON SHARED bullet, bullet1, mag, mag1, numofbullets, numofhits, numofbullets1, numofhits1
COMMON SHARED wounded, wounded1, bluecash, redcash, bluep, bluepmag, bluer, bluermag
COMMON SHARED redp, redpmag, redr, redrmag, twoplr
'Variable Key:
'mag
'bullet
'speed
'stance$
'stance
'wounded$
'wounded
'gotomenu
'bluecash
'redcash

SCREEN 13
RANDOMIZE TIMER
gotomenu = 1
5
RESET
CLS
mag = 10
mag1 = 10
bullet = 45
bullet1 = 45
bluecash = 500
redcash = 500
speed = 5
3
stance$ = "crouched"
stance1$ = "crouched"
stance = 0
stance1 = 0
wounded = 0
wounded1 = 0


IF gotomenu = 1 THEN gotomenu = 0: CALL menu
CALL drawworld
1

'Rifle
'PSET (240, 124), 1: DRAW "ta0 c8 bm-15,+0 m+10,+0 m-5,+5 bm+5,-5 m+5,+0 m+0,+5 bm+0,-5 m+10,+0 m+0,+5 m-10,-5 m+0,-2 m-10,+0 m+0,+2 ta0"

a$ = INKEY$

IF a$ = CHR$(27) THEN CALL menu

'2 player code

IF twoplr = 1 THEN
rndm = RND * 10
npcreacttime = npcreacttime - 1
IF npcreacttime < 0 THEN npcreacttime = 0

IF npcreacttime = 0 THEN
IF stance1$ = "crouched" AND rndm < .001 THEN npcreacttime = 1000: npc$ = "react stand"
IF stance1$ = "standing" AND rndm > 9.998 THEN npcreacttime = 1000: npc$ = "react crouch"

IF npc$ = "react stand" THEN a$ = "8": npc$ = ""
IF npc$ = "react crouch" THEN a$ = "5": npc$ = "": npcreacttime = 5000
IF npc$ = "reload" THEN a$ = "6": npc$ = ""
IF bullet1 < 15 THEN
IF stance1$ = "crouched" THEN npcreacttime = 1000: npc$ = "reload"
IF stance1$ = "standing" THEN npcreacttime = 1500: npc$ = "react crouch"
END IF

IF stance$ <> "crouched" THEN

IF npc$ = "react fire" THEN a$ = "4": npc$ = ""
IF stance1$ <> "standing" THEN
IF rndm > 5 AND bullet1 >= 15 THEN npcreacttime = 1000: npc$ = "react stand"
IF rndm < 5 THEN npcreacttime = 1000: npc$ = "react crouch"
END IF
IF stance1$ = "standing" AND bullet1 >= 15 AND stance$ = "standing" THEN npcreacttime = 1000: npc$ = "react fire"

END IF

END IF
IF fire > 0 AND rndm > 3 THEN npcreacttime = 500: npc$ = "react crouch"

END IF

'Change Stance

IF a$ = "s" AND stance$ <> "crouched" THEN stance$ = "standing to crouched": CIRCLE (69, 120), 3, 0: PAINT STEP(0, 0), 0: DRAW "bm-5,+5 m+10,+5 m+10,-5 m-1,-1 m+6,+0 bm-5,+1 m-10,+0 m-10,+0 m-5,+10 m+10,+5 m+0,+10 bm-20,+0 m+10,-5 m+0,-10": SOUND 50, 1: GOTO skip
IF a$ = "w" AND stance$ <> "standing" THEN stance$ = "crouched to standing": CIRCLE (69, 130), 3, 0: PAINT STEP(0, 0), 0: DRAW "bm+5,+5 m-15,+0 m+5,-10 m+2,+1 m+0,-6 bm-2,+5 m+0,+10 m+10,+0 m-5,+10 m-10,-5 m-5,+10 bm+15,0 m-10,+0 m+10,-5": SOUND 100, 1: GOTO skip
IF a$ = "5" AND stance1$ <> "crouched" THEN stance1$ = "standing to crouched": CIRCLE (246, 120), 3, 0: PAINT STEP(0, 0), 0: DRAW "bm+5,+5 m-10,+5 m-10,-5 m+1,-1 m-6,+0 bm+5,+1 m+10,+0 m+10,+0 m+5,+10 m-10,+5 m-0,+10 bm+20,+0 m-10,-5 m+0,-10": SOUND 150, 1: GOTO skip
IF a$ = "8" AND stance1$ <> "standing" THEN stance1$ = "crouched to standing": CIRCLE (246, 130), 3, 0: PAINT STEP(0, 0), 0: DRAW "bm-5,+5 m+15,+0 m-5,-10 m-2,+1 m-0,-6 bm+2,+5 m-0,+10 m-10,+0 m+5,+10 m+10,-5 m+5,+10 bm-15,0 m+10,+0 m-10,-5": SOUND 200, 1: GOTO skip
skip:

'*****BLUE*****

IF stance$ = "standing" THEN CIRCLE (69, 120), 3, 66: PAINT STEP(0, 0), 66: DRAW "c1 bm-5,+5 m+10,+5 c66 m+10,-5 c8 m-1,-1 m+6,+0 bm-5,+1 c66 m-10,+0 c1 m-10,+0 m-5,+10 m+10,+5 m+0,+10 bm-20,+0 m+10,-5 m+0,-10"': PSET (75, 124), 0: DRAW "ta0 c8 bm+15,+0 m-10,+0 m+5,+5 bm-5,-5 m-5,+0 m+0,+5 bm+0,-5 m-10,+0 m+0,+5 m+10,-5 m+0,-2 m+10,+0 m+0,+2 ta0"
IF stance$ = "crouched" THEN CIRCLE (69, 130), 3, 66: PAINT STEP(0, 0), 66: DRAW " c1 bm+5,+5 m-15,+0 c66 m+5,-10 c8 m+2,+1 m+0,-6 bm-2,+5 c66 m+0,+10 c1 m+10,+0 m-5,+10 m-10,-5 m-5,+10 bm+15,0 m-10,+0 m+10,-5"': PSET (75, 124), 0: DRAW "ta0 bm+15,+0 m-10,+0 m+5,+5 bm-5,-5 m-5,+0 m+0,+5 bm+0,-5 m-10,+0 m+0,+5 m+10,-5 m+0,-2 m+10,+0 m+0,+2 ta0"


IF stance$ = "crouched to standing" THEN
stance = stance + 1
CIRCLE (64, 125), 3, 66: PAINT STEP(0, 0), 66: DRAW "bm-5,+5 c1 m+10,+5 c66 m+5,-10 c8 m-1,-1 m+3,-5 bm-2,+6 c66 m-5,+5 c1 m-10,+0 m-5,+10 m+10,+0 m+5,+10 bm-20,+0 m+10,+0 m-5,-10"
IF stance > 500 THEN stance$ = "standing": CIRCLE (64, 125), 3, 0: PAINT STEP(0, 0), 0: DRAW "bm-5,+5 m+10,+5 m+5,-10 m-1,-1 m+3,-5 bm-2,+6 m-5,+5 m-10,+0 m-5,+10 m+10,+0 m+5,+10 bm-20,+0 m+10,+0 m-5,-10"
END IF

IF stance$ = "standing to crouched" THEN
stance = stance - 1: CIRCLE (64, 125), 3, 66: PAINT STEP(0, 0), 66: DRAW "bm-5,+5 c1 m+10,+5 c66 m+5,-10 c8 m-1,-1 m+3,-5 bm-2,+6 c66 m-5,+5 c1 m-10,+0 m-5,+10 m+10,+0 m+5,+10 bm-20,+0 m+10,+0 m-5,-10"
IF stance < 0 THEN stance$ = "crouched": CIRCLE (64, 125), 3, 0: PAINT STEP(0, 0), 0: DRAW "bm-5,+5 m+10,+5 m+5,-10 m-1,-1 m+3,-5 bm-2,+6 m-5,+5 m-10,+0 m-5,+10 m+10,+0 m+5,+10 bm-20,+0 m+10,+0 m-5,-10"
END IF

IF bullet < 15 AND a$ = "d" AND stance$ = "standing" AND fire <= 0 THEN SOUND 5000, 1
IF bullet >= 15 AND a$ = "d" AND stance$ = "standing" AND fire <= 0 THEN
numofbullets = numofbullets + 1
bullet = bullet - 5
fire = 100
IF bullet > 15 THEN PSET (30, bullet - 5): DRAW "c14 m+0,+2 m+0,-1 m+1,+0 ": LINE STEP(1, -1)-STEP(4, 2), 14, BF: LINE STEP(1, -2)-STEP(1, 2), 8, BF: PSET STEP(1, -1), 8
PSET (30, bullet), 0: DRAW "c0 m+0,+2 m+0,-1 m+1,+0 ": LINE STEP(1, -1)-STEP(4, 2), 0, BF: LINE STEP(1, -2)-STEP(1, 2), 0, BF: PSET STEP(1, -1), 0
END IF


IF fire > 0 THEN
IF fire > 50 THEN CIRCLE (94, 124), 5, 14: PAINT STEP(0, 0), 14: LINE STEP(0, 0)-STEP(20, 0), 14
IF fire < 50 THEN CIRCLE (94, 124), 5, 0: PAINT STEP(0, 0), 0: LINE STEP(0, 0)-STEP(20, 0), 0
IF fire <= speed THEN
PSET (RND * 15 + 300, RND * 20 + 115), 0: CIRCLE STEP(0, 0), 1, 7
luck = INT(RND * 100)
IF stance1$ = "standing" AND luck > 50 + (10 * wounded1) THEN
numofhits = numofhits + 1
wounded = wounded + 1
IF wounded = 1 THEN LOCATE 2, 28: COLOR 4: PRINT "Wounded"
IF wounded = 2 THEN LOCATE 3, 27: COLOR 4: PRINT "Critical"
FOR delay = 0 TO 20
SOUND delay * 100 + 50, .1
CIRCLE STEP(RND * 6 - 3, RND * 6 - 3), RND * 1, 4: PAINT STEP(0, 0), 4
NEXT
END IF
END IF
SOUND fire * 10 + 50, .05
SOUND 1000, .05
fire = fire - speed
IF wounded >= 3 THEN GOTO 2
END IF

IF a$ = "a" AND bullet < 25 AND stance$ = "crouched" AND mag > 0 THEN
FOR bullet = 10 TO 40 STEP 5
PSET (30, bullet): DRAW "c14 m+0,+2 m+0,-1 m+1,+0 ": LINE STEP(1, -1)-STEP(4, 2), 14, BF: LINE STEP(1, -2)-STEP(1, 2), 8, BF: PSET STEP(1, -1), 8
SOUND bullet * 50 + 50, .5
NEXT
mag = mag - 1
LOCATE 1, 4: COLOR 1: PRINT mag
END IF

IF mag = 0 AND bullet = 10 THEN GOTO 4


'*****RED*****

'*****Draw Stances*****

IF stance1$ = "standing" THEN CIRCLE (246, 120), 3, 66: PAINT STEP(0, 0), 66: DRAW "c4 bm+5,+5 m-10,+5 c66 m-10,-5 c8 m+1,-1 m-6,+0 bm+5,+1 c66 m+10,+0 c4 m+10,+0 m+5,+10 m-10,+5 m+0,+10 bm+20,+0 m-10,-5 m+0,-10"
IF stance1$ = "crouched" THEN CIRCLE (246, 130), 3, 66: PAINT STEP(0, 0), 66: DRAW " c4 bm-5,+5 m+15,+0 c66 m-5,-10 c8 m-2,+1 m+0,-6 bm+2,+5 c66 m+0,+10 c4 m-10,+0 m+5,+10 m+10,-5 m+5,+10 bm-15,0 m+10,+0 m-10,-5"

IF stance1$ = "crouched to standing" THEN
stance1 = stance1 + 1: CIRCLE (251, 125), 3, 66: PAINT STEP(0, 0), 66: DRAW "bm+5,+5 c4 m-10,+5 c66 m-5,-10 c8 m+1,-1 m-3,-5 bm+2,+6 c66 m+5,+5 c4 m+10,+0 m+5,+10 m-10,+0 m-5,+10 bm+20,+0 m-10,+0 m+5,-10"
IF stance1 > 500 THEN stance1$ = "standing": CIRCLE (251, 125), 3, 0: PAINT STEP(0, 0), 0: DRAW "bm+5,+5 m-10,+5 m-5,-10 m+1,-1 m-3,-5 bm+2,+6 m+5,+5 m+10,+0 m+5,+10 m-10,+0 m-5,+10 bm+20,+0 m-10,+0 m+5,-10"
END IF

IF stance1$ = "standing to crouched" THEN
stance1 = stance1 - 1
CIRCLE (251, 125), 3, 66: PAINT STEP(0, 0), 66: DRAW "bm+5,+5 c4 m-10,+5 c66 m-5,-10 c8 m+1,-1 m-3,-5 bm+2,+6 c66 m+5,+5 c4 m+10,+0 m+5,+10 m-10,+0 m-5,+10 bm+20,+0 m-10,+0 m+5,-10"
IF stance1 < 0 THEN stance1$ = "crouched": CIRCLE (251, 125), 3, 0: PAINT STEP(0, 0), 0: DRAW "bm+5,+5 m-10,+5 m-5,-10 m+1,-1 m-3,-5 bm+2,+6 m+5,+5 m+10,+0 m+5,+10 m-10,+0 m-5,+10 bm+20,+0 m-10,+0 m+5,-10"
END IF

'**********************

IF bullet1 < 15 AND a$ = "4" AND stance1$ = "standing" AND fire1 <= 0 THEN SOUND 5000, 1
IF bullet1 >= 15 AND a$ = "4" AND stance1$ = "standing" AND fire1 <= 0 THEN
accuracy1 = accuracy1 + 25
numofbullets1 = numofbullets1 + 1
bullet1 = bullet1 - 5
fire1 = 100
IF bullet1 > 15 THEN PSET (290, bullet1 - 5): DRAW "c14 m+0,+2 m+0,-1 m-1,+0 ": LINE STEP(-1, -1)-STEP(-4, 2), 14, BF: LINE STEP(-1, -2)-STEP(-1, 2), 8, BF: PSET STEP(-1, -1), 8
PSET (290, bullet1), 0: DRAW "c0 m+0,+2 m+0,-1 m-1,+0 ": LINE STEP(-1, -1)-STEP(-4, 2), 0, BF: LINE STEP(-1, -2)-STEP(-1, 2), 0, BF: PSET STEP(-1, -1), 0
END IF

IF fire1 > 0 THEN
IF fire1 > 50 THEN CIRCLE (220, 124), 5, 14: PAINT STEP(0, 0), 14: LINE STEP(0, 0)-STEP(-20, 0), 14
IF fire1 < 50 THEN CIRCLE (220, 124), 5, 0: PAINT STEP(0, 0), 0: LINE STEP(0, 0)-STEP(-20, 0), 0
IF fire1 <= speed THEN
PSET (RND * 15 + 5, RND * 20 + 115), 0: CIRCLE STEP(0, 0), 1, 7
luck = INT(RND * 100)
IF stance$ = "standing" AND luck > 50 + (10 * wounded) THEN
numofhits1 = numofhits1 + 1
wounded1 = wounded1 + 1
IF wounded1 = 1 THEN LOCATE 2, 7: COLOR 4: PRINT "Wounded"
IF wounded1 = 2 THEN LOCATE 3, 7: COLOR 4: PRINT "Critical"
FOR delay = 0 TO 20
SOUND delay * 200 + 50, .1
CIRCLE STEP(RND * 6 - 3, RND * 6 - 3), RND * 1, 4: PAINT STEP(0, 0), 4
NEXT
END IF
END IF
SOUND fire1 * 20 + 50, .05
SOUND 2000, .05
fire1 = fire1 - speed
IF wounded1 >= 3 THEN GOTO 2
END IF

IF a$ = "6" AND bullet1 < 25 AND stance1$ = "crouched" AND mag1 > 0 THEN
FOR bullet1 = 10 TO 40 STEP 5
PSET (290, bullet1): DRAW "c14 m+0,+2 m+0,-1 m-1,+0 ": LINE STEP(-1, -1)-STEP(-4, 2), 14, BF: LINE STEP(-1, -2)-STEP(-1, 2), 8, BF: PSET STEP(-1, -1), 8
SOUND bullet1 * 100 + 50, .5
NEXT
mag1 = mag1 - 1
LOCATE 1, 36: COLOR 4: PRINT mag1
END IF

IF mag1 = 0 AND bullet1 = 10 THEN GOTO 4

GOTO 1

2
LOCATE 1, 8
IF wounded > wounded1 THEN COLOR 1: PRINT "!! Blue wins + œ100 !!": mag = mag + 1'bluecash = bluecash + 100
IF wounded < wounded1 THEN COLOR 4: PRINT "!! Red wins + œ100 !!": mag1 = mag1 + 1'redcash = redcash + 100
FOR delay = 0 TO 5
IF wounded > wounded1 THEN SOUND 1000, .5: SOUND 1100, .5
IF wounded < wounded1 THEN SOUND 2000, .5: SOUND 2100, .5
NEXT
CLS
GOTO 3

4
FOR delay = 0 TO 10
LOCATE 10, 9
IF mag1 = 0 THEN COLOR 1: PRINT "!! BLUE WINS THE GAME !!": SOUND 1000, 1: SOUND 1100, 1
IF mag = 0 THEN COLOR 4: PRINT "!! RED WINS THE GAME !!": SOUND 2000, 1: SOUND 2100, 1
NEXT

LINE (45, 0)-(270, 120), 0, BF

gotomenu = 1

CALL stats
CALL menu
GOTO 5

Quote
Like
Share

K3Y
Joined: May 15th, 2007, 11:02 pm

May 15th, 2007, 11:12 pm #3

This is a program ive been working on for a while. I'm planning on adding other things to it in future.

I need someone to suggest ways of improving the code ...whether it be an easier way of producing the graphics or something more complex.

Any feedback is welcome.
Quote
Like
Share

Joined: January 1st, 1970, 12:00 am

May 16th, 2007, 11:16 am #4

Please post a version that runs.

This one has
CALL MENU

but no such SUB exists.

Try this: Post your program and then copy it to your computer from your post. Ensure it works.

You can just post it again and I will delete the old version.

Mac
Quote
Like
Share

K3Y
Joined: May 15th, 2007, 11:02 pm

May 16th, 2007, 11:51 am #5

My apologies
Quote
Like
Share

K3Y
Joined: May 15th, 2007, 11:02 pm

May 16th, 2007, 11:52 am #6

ProgramList K3Y
DECLARE SUB drawworld ()
DECLARE SUB menu ()
DECLARE SUB stats ()
COMMON SHARED bullet, bullet1, mag, mag1, numofbullets, numofhits, numofbullets1, numofhits1
COMMON SHARED wounded, wounded1, bluecash, redcash, bluep, bluepmag, bluer, bluermag
COMMON SHARED redp, redpmag, redr, redrmag, twoplr
'Variable Key:
'mag
'bullet
'speed
'stance$
'stance
'wounded$
'wounded
'gotomenu
'bluecash
'redcash

SCREEN 13
RANDOMIZE TIMER
gotomenu = 1
5
RESET
CLS
mag = 10
mag1 = 10
bullet = 45
bullet1 = 45
bluecash = 500
redcash = 500
speed = 5
3
stance$ = "crouched"
stance1$ = "crouched"
stance = 0
stance1 = 0
wounded = 0
wounded1 = 0


IF gotomenu = 1 THEN gotomenu = 0: CALL menu
CALL drawworld
1

'Rifle
'PSET (240, 124), 1: DRAW "ta0 c8 bm-15,+0 m+10,+0 m-5,+5 bm+5,-5 m+5,+0 m+0,+5 bm+0,-5 m+10,+0 m+0,+5 m-10,-5 m+0,-2 m-10,+0 m+0,+2 ta0"

a$ = INKEY$

IF a$ = CHR$(27) THEN CALL menu

'2 player code

IF twoplr = 1 THEN
rndm = RND * 10
npcreacttime = npcreacttime - 1
IF npcreacttime < 0 THEN npcreacttime = 0

IF npcreacttime = 0 THEN
IF stance1$ = "crouched" AND rndm < .001 THEN npcreacttime = 1000: npc$ = "react stand"
IF stance1$ = "standing" AND rndm > 9.998 THEN npcreacttime = 1000: npc$ = "react crouch"

IF npc$ = "react stand" THEN a$ = "8": npc$ = ""
IF npc$ = "react crouch" THEN a$ = "5": npc$ = "": npcreacttime = 5000
IF npc$ = "reload" THEN a$ = "6": npc$ = ""
IF bullet1 < 15 THEN
IF stance1$ = "crouched" THEN npcreacttime = 1000: npc$ = "reload"
IF stance1$ = "standing" THEN npcreacttime = 1500: npc$ = "react crouch"
END IF

IF stance$ <> "crouched" THEN

IF npc$ = "react fire" THEN a$ = "4": npc$ = ""
IF stance1$ <> "standing" THEN
IF rndm > 5 AND bullet1 >= 15 THEN npcreacttime = 1000: npc$ = "react stand"
IF rndm < 5 THEN npcreacttime = 1000: npc$ = "react crouch"
END IF
IF stance1$ = "standing" AND bullet1 >= 15 AND stance$ = "standing" THEN npcreacttime = 1000: npc$ = "react fire"

END IF

END IF
IF fire > 0 AND rndm > 3 THEN npcreacttime = 500: npc$ = "react crouch"

END IF

'Change Stance

IF a$ = "s" AND stance$ <> "crouched" THEN stance$ = "standing to crouched": CIRCLE (69, 120), 3, 0: PAINT STEP(0, 0), 0: DRAW "bm-5,+5 m+10,+5 m+10,-5 m-1,-1 m+6,+0 bm-5,+1 m-10,+0 m-10,+0 m-5,+10 m+10,+5 m+0,+10 bm-20,+0 m+10,-5 m+0,-10": SOUND _
50, 1: GOTO skip
IF a$ = "w" AND stance$ <> "standing" THEN stance$ = "crouched to standing": CIRCLE (69, 130), 3, 0: PAINT STEP(0, 0), 0: DRAW "bm+5,+5 m-15,+0 m+5,-10 m+2,+1 m+0,-6 bm-2,+5 m+0,+10 m+10,+0 m-5,+10 m-10,-5 m-5,+10 bm+15,0 m-10,+0 m+10,-5": SOUND _
100, 1: GOTO skip
IF a$ = "5" AND stance1$ <> "crouched" THEN stance1$ = "standing to crouched": CIRCLE (246, 120), 3, 0: PAINT STEP(0, 0), 0: DRAW "bm+5,+5 m-10,+5 m-10,-5 m+1,-1 m-6,+0 bm+5,+1 m+10,+0 m+10,+0 m+5,+10 m-10,+5 m-0,+10 bm+20,+0 m-10,-5 m+0,-10": _
SOUND 150, 1: GOTO skip
IF a$ = "8" AND stance1$ <> "standing" THEN stance1$ = "crouched to standing": CIRCLE (246, 130), 3, 0: PAINT STEP(0, 0), 0: DRAW "bm-5,+5 m+15,+0 m-5,-10 m-2,+1 m-0,-6 bm+2,+5 m-0,+10 m-10,+0 m+5,+10 m+10,-5 m+5,+10 bm-15,0 m+10,+0 m-10,-5": _
SOUND 200, 1: GOTO skip
skip:

'*****BLUE*****

IF stance$ = "standing" THEN CIRCLE (69, 120), 3, 66: PAINT STEP(0, 0), 66: DRAW "c1 bm-5,+5 m+10,+5 c66 m+10,-5 c8 m-1,-1 m+6,+0 bm-5,+1 c66 m-10,+0 c1 m-10,+0 m-5,+10 m+10,+5 m+0,+10 bm-20,+0 m+10,-5 m+0,-10" _
': PSET (75, 124), 0: DRAW "ta0 c8 bm+15,+0 m-10,+0 m+5,+5 bm-5,-5 m-5,+0 m+0,+5 bm+0,-5 m-10,+0 m+0,+5 m+10,-5 m+0,-2 m+10,+0 m+0,+2 ta0"
IF stance$ = "crouched" THEN CIRCLE (69, 130), 3, 66: PAINT STEP(0, 0), 66: DRAW " c1 bm+5,+5 m-15,+0 c66 m+5,-10 c8 m+2,+1 m+0,-6 bm-2,+5 c66 m+0,+10 c1 m+10,+0 m-5,+10 m-10,-5 m-5,+10 bm+15,0 m-10,+0 m+10,-5" _
': PSET (75, 124), 0: DRAW "ta0 bm+15,+0 m-10,+0 m+5,+5 bm-5,-5 m-5,+0 m+0,+5 bm+0,-5 m-10,+0 m+0,+5 m+10,-5 m+0,-2 m+10,+0 m+0,+2 ta0"


IF stance$ = "crouched to standing" THEN
stance = stance + 1
CIRCLE (64, 125), 3, 66: PAINT STEP(0, 0), 66: DRAW "bm-5,+5 c1 m+10,+5 c66 m+5,-10 c8 m-1,-1 m+3,-5 bm-2,+6 c66 m-5,+5 c1 m-10,+0 m-5,+10 m+10,+0 m+5,+10 bm-20,+0 m+10,+0 m-5,-10"
IF stance > 500 THEN stance$ = "standing": CIRCLE (64, 125), 3, 0: PAINT STEP(0, 0), 0: DRAW "bm-5,+5 m+10,+5 m+5,-10 m-1,-1 m+3,-5 bm-2,+6 m-5,+5 m-10,+0 m-5,+10 m+10,+0 m+5,+10 bm-20,+0 m+10,+0 m-5,-10"
END IF

IF stance$ = "standing to crouched" THEN
stance = stance - 1: CIRCLE (64, 125), 3, 66: PAINT STEP(0, 0), 66: DRAW "bm-5,+5 c1 m+10,+5 c66 m+5,-10 c8 m-1,-1 m+3,-5 bm-2,+6 c66 m-5,+5 c1 m-10,+0 m-5,+10 m+10,+0 m+5,+10 bm-20,+0 m+10,+0 m-5,-10"
IF stance < 0 THEN stance$ = "crouched": CIRCLE (64, 125), 3, 0: PAINT STEP(0, 0), 0: DRAW "bm-5,+5 m+10,+5 m+5,-10 m-1,-1 m+3,-5 bm-2,+6 m-5,+5 m-10,+0 m-5,+10 m+10,+0 m+5,+10 bm-20,+0 m+10,+0 m-5,-10"
END IF

IF bullet < 15 AND a$ = "d" AND stance$ = "standing" AND fire <= 0 THEN SOUND 5000, 1
IF bullet >= 15 AND a$ = "d" AND stance$ = "standing" AND fire <= 0 THEN
numofbullets = numofbullets + 1
bullet = bullet - 5
fire = 100
IF bullet > 15 THEN PSET (30, bullet - 5): DRAW "c14 m+0,+2 m+0,-1 m+1,+0 ": LINE STEP(1, -1)-STEP(4, 2), 14, BF: LINE STEP(1, -2)-STEP(1, 2), 8, BF: PSET STEP(1, -1), 8
PSET (30, bullet), 0: DRAW "c0 m+0,+2 m+0,-1 m+1,+0 ": LINE STEP(1, -1)-STEP(4, 2), 0, BF: LINE STEP(1, -2)-STEP(1, 2), 0, BF: PSET STEP(1, -1), 0
END IF


IF fire > 0 THEN
IF fire > 50 THEN CIRCLE (94, 124), 5, 14: PAINT STEP(0, 0), 14: LINE STEP(0, 0)-STEP(20, 0), 14
IF fire < 50 THEN CIRCLE (94, 124), 5, 0: PAINT STEP(0, 0), 0: LINE STEP(0, 0)-STEP(20, 0), 0
IF fire <= speed THEN
PSET (RND * 15 + 300, RND * 20 + 115), 0: CIRCLE STEP(0, 0), 1, 7
luck = INT(RND * 100)
IF stance1$ = "standing" AND luck > 50 + (10 * wounded1) THEN
numofhits = numofhits + 1
wounded = wounded + 1
IF wounded = 1 THEN LOCATE 2, 28: COLOR 4: PRINT "Wounded"
IF wounded = 2 THEN LOCATE 3, 27: COLOR 4: PRINT "Critical"
FOR delay = 0 TO 20
SOUND delay * 100 + 50, .1
CIRCLE STEP(RND * 6 - 3, RND * 6 - 3), RND * 1, 4: PAINT STEP(0, 0), 4
NEXT
END IF
END IF
SOUND fire * 10 + 50, .05
SOUND 1000, .05
fire = fire - speed
IF wounded >= 3 THEN GOTO 2
END IF

IF a$ = "a" AND bullet < 25 AND stance$ = "crouched" AND mag > 0 THEN
FOR bullet = 10 TO 40 STEP 5
PSET (30, bullet): DRAW "c14 m+0,+2 m+0,-1 m+1,+0 ": LINE STEP(1, -1)-STEP(4, 2), 14, BF: LINE STEP(1, -2)-STEP(1, 2), 8, BF: PSET STEP(1, -1), 8
SOUND bullet * 50 + 50, .5
NEXT
mag = mag - 1
LOCATE 1, 4: COLOR 1: PRINT mag
END IF

IF mag = 0 AND bullet = 10 THEN GOTO 4


'*****RED*****

'*****Draw Stances*****

IF stance1$ = "standing" THEN CIRCLE (246, 120), 3, 66: PAINT STEP(0, 0), 66: DRAW "c4 bm+5,+5 m-10,+5 c66 m-10,-5 c8 m+1,-1 m-6,+0 bm+5,+1 c66 m+10,+0 c4 m+10,+0 m+5,+10 m-10,+5 m+0,+10 bm+20,+0 m-10,-5 m+0,-10"
IF stance1$ = "crouched" THEN CIRCLE (246, 130), 3, 66: PAINT STEP(0, 0), 66: DRAW " c4 bm-5,+5 m+15,+0 c66 m-5,-10 c8 m-2,+1 m+0,-6 bm+2,+5 c66 m+0,+10 c4 m-10,+0 m+5,+10 m+10,-5 m+5,+10 bm-15,0 m+10,+0 m-10,-5"

IF stance1$ = "crouched to standing" THEN
stance1 = stance1 + 1: CIRCLE (251, 125), 3, 66: PAINT STEP(0, 0), 66: DRAW "bm+5,+5 c4 m-10,+5 c66 m-5,-10 c8 m+1,-1 m-3,-5 bm+2,+6 c66 m+5,+5 c4 m+10,+0 m+5,+10 m-10,+0 m-5,+10 bm+20,+0 m-10,+0 m+5,-10"
IF stance1 > 500 THEN stance1$ = "standing": CIRCLE (251, 125), 3, 0: PAINT STEP(0, 0), 0: DRAW "bm+5,+5 m-10,+5 m-5,-10 m+1,-1 m-3,-5 bm+2,+6 m+5,+5 m+10,+0 m+5,+10 m-10,+0 m-5,+10 bm+20,+0 m-10,+0 m+5,-10"
END IF

IF stance1$ = "standing to crouched" THEN
stance1 = stance1 - 1
CIRCLE (251, 125), 3, 66: PAINT STEP(0, 0), 66: DRAW "bm+5,+5 c4 m-10,+5 c66 m-5,-10 c8 m+1,-1 m-3,-5 bm+2,+6 c66 m+5,+5 c4 m+10,+0 m+5,+10 m-10,+0 m-5,+10 bm+20,+0 m-10,+0 m+5,-10"
IF stance1 < 0 THEN stance1$ = "crouched": CIRCLE (251, 125), 3, 0: PAINT STEP(0, 0), 0: DRAW "bm+5,+5 m-10,+5 m-5,-10 m+1,-1 m-3,-5 bm+2,+6 m+5,+5 m+10,+0 m+5,+10 m-10,+0 m-5,+10 bm+20,+0 m-10,+0 m+5,-10"
END IF

'**********************

IF bullet1 < 15 AND a$ = "4" AND stance1$ = "standing" AND fire1 <= 0 THEN SOUND 5000, 1
IF bullet1 >= 15 AND a$ = "4" AND stance1$ = "standing" AND fire1 <= 0 THEN
accuracy1 = accuracy1 + 25
numofbullets1 = numofbullets1 + 1
bullet1 = bullet1 - 5
fire1 = 100
IF bullet1 > 15 THEN PSET (290, bullet1 - 5): DRAW "c14 m+0,+2 m+0,-1 m-1,+0 ": LINE STEP(-1, -1)-STEP(-4, 2), 14, BF: LINE STEP(-1, -2)-STEP(-1, 2), 8, BF: PSET STEP(-1, -1), 8
PSET (290, bullet1), 0: DRAW "c0 m+0,+2 m+0,-1 m-1,+0 ": LINE STEP(-1, -1)-STEP(-4, 2), 0, BF: LINE STEP(-1, -2)-STEP(-1, 2), 0, BF: PSET STEP(-1, -1), 0
END IF

IF fire1 > 0 THEN
IF fire1 > 50 THEN CIRCLE (220, 124), 5, 14: PAINT STEP(0, 0), 14: LINE STEP(0, 0)-STEP(-20, 0), 14
IF fire1 < 50 THEN CIRCLE (220, 124), 5, 0: PAINT STEP(0, 0), 0: LINE STEP(0, 0)-STEP(-20, 0), 0
IF fire1 <= speed THEN
PSET (RND * 15 + 5, RND * 20 + 115), 0: CIRCLE STEP(0, 0), 1, 7
luck = INT(RND * 100)
IF stance$ = "standing" AND luck > 50 + (10 * wounded) THEN
numofhits1 = numofhits1 + 1
wounded1 = wounded1 + 1
IF wounded1 = 1 THEN LOCATE 2, 7: COLOR 4: PRINT "Wounded"
IF wounded1 = 2 THEN LOCATE 3, 7: COLOR 4: PRINT "Critical"
FOR delay = 0 TO 20
SOUND delay * 200 + 50, .1
CIRCLE STEP(RND * 6 - 3, RND * 6 - 3), RND * 1, 4: PAINT STEP(0, 0), 4
NEXT
END IF
END IF
SOUND fire1 * 20 + 50, .05
SOUND 2000, .05
fire1 = fire1 - speed
IF wounded1 >= 3 THEN GOTO 2
END IF

IF a$ = "6" AND bullet1 < 25 AND stance1$ = "crouched" AND mag1 > 0 THEN
FOR bullet1 = 10 TO 40 STEP 5
PSET (290, bullet1): DRAW "c14 m+0,+2 m+0,-1 m-1,+0 ": LINE STEP(-1, -1)-STEP(-4, 2), 14, BF: LINE STEP(-1, -2)-STEP(-1, 2), 8, BF: PSET STEP(-1, -1), 8
SOUND bullet1 * 100 + 50, .5
NEXT
mag1 = mag1 - 1
LOCATE 1, 36: COLOR 4: PRINT mag1
END IF

IF mag1 = 0 AND bullet1 = 10 THEN GOTO 4

GOTO 1

2
LOCATE 1, 8
IF wounded > wounded1 THEN COLOR 1: PRINT "!! Blue wins + œ100 !!": mag = mag + 1'bluecash = bluecash + 100
IF wounded < wounded1 THEN COLOR 4: PRINT "!! Red wins + œ100 !!": mag1 = mag1 + 1'redcash = redcash + 100
FOR delay = 0 TO 5
IF wounded > wounded1 THEN SOUND 1000, .5: SOUND 1100, .5
IF wounded < wounded1 THEN SOUND 2000, .5: SOUND 2100, .5
NEXT
CLS
GOTO 3

4
FOR delay = 0 TO 10
LOCATE 10, 9
IF mag1 = 0 THEN COLOR 1: PRINT "!! BLUE WINS THE GAME !!": SOUND 1000, 1: SOUND 1100, 1
IF mag = 0 THEN COLOR 4: PRINT "!! RED WINS THE GAME !!": SOUND 2000, 1: SOUND 2100, 1
NEXT

LINE (45, 0)-(270, 120), 0, BF

gotomenu = 1

CALL stats
CALL menu
GOTO 5


SUB Blue

END SUB

SUB drawworld

'Draw World
CIRCLE (69, 130), 3, 66: PAINT STEP(0, 0), 66: DRAW " c1 bm+5,+5 m-15,+0 c66 m+5,-10 c8 m+2,+1 m+0,-6 bm-2,+5 c66 m+0,+10 c1 m+10,+0 m-5,+10 m-10,-5 m-5,+10 bm+15,0 m-10,+0 m+10,-5"
CIRCLE (246, 130), 3, 66: PAINT STEP(0, 0), 66: DRAW " c4 bm-5,+5 m+15,+0 c66 m-5,-10 c8 m-2,+1 m+0,-6 bm+2,+5 c66 m+0,+10 c4 m-10,+0 m+5,+10 m+10,-5 m+5,+10 bm-15,0 m+10,+0 m-10,-5"
LINE (0, 10)-STEP(25, 140), 31, BF
LINE (295, 10)-STEP(25, 140), 31, BF
LINE (0, 151)-(320, 200), 8, BF
LINE (75, 130)-STEP(20, 20), 6, BF
LINE (220, 130)-STEP(20, 20), 6, BF
LINE (28, 8)-STEP(13, 36), 8, B
LINE (279, 8)-STEP(13, 36), 8, B

'Load Magazines
oldbullet = bullet - 5
FOR bullet = 10 TO oldbullet STEP 5
PSET (30, bullet): DRAW "c14 m+0,+2 m+0,-1 m+1,+0 ": LINE STEP(1, -1)-STEP(4, 2), 14, BF: LINE STEP(1, -2)-STEP(1, 2), 8, BF: PSET STEP(1, -1), 8
SOUND bullet * 50 + 50, .5
NEXT

oldbullet1 = bullet1 - 5
FOR bullet1 = 10 TO oldbullet1 STEP 5
PSET (290, bullet1): DRAW "c14 m+0,+2 m+0,-1 m-1,+0 ": LINE STEP(-1, -1)-STEP(-4, 2), 14, BF: LINE STEP(-1, -2)-STEP(-1, 2), 8, BF: PSET STEP(-1, -1), 8
SOUND bullet1 * 100 + 50, .5
NEXT

'Print Text
LOCATE 1, 4: COLOR 1: PRINT mag
LOCATE 1, 35: COLOR 4: PRINT mag1

END SUB

SUB menu
COLOR 15
LOCATE 2, 18: PRINT "Menu"
LOCATE 4, 17: PRINT "2 Player"
LOCATE 5, 17: PRINT "1 Player"
LOCATE 6, 17: PRINT "Controls"
LOCATE 7, 17: PRINT "Quit"
LOCATE 9, 8: PRINT "(SPACE)-Select"

DO

LOCATE menu1 + 3, 16: COLOR 1: PRINT " ": LOCATE menu1 + 3, 25: COLOR 4: PRINT " "
LOCATE menu1 + 4, 16: COLOR 1: PRINT "*": LOCATE menu1 + 4, 25: COLOR 4: PRINT "*"
LOCATE menu1 + 5, 16: COLOR 1: PRINT " ": LOCATE menu1 + 5, 25: COLOR 4: PRINT " "
a$ = INKEY$
IF a$ = CHR$(0) + "P" THEN menu1 = menu1 + 1
IF a$ = CHR$(0) + "H" THEN menu1 = menu1 - 1
IF menu1 < 0 THEN menu1 = 0
IF menu1 > 3 THEN menu1 = 3
LOOP UNTIL a$ = CHR$(32)
LINE (45, 0)-(270, 110), 0, BF
IF menu1 = 0 THEN GOTO 50'RETURN
IF menu1 = 1 THEN twoplr = 1: GOTO 50
IF menu1 = 2 THEN GOTO menucontrols
IF menu1 = 3 THEN END

menucontrols:
COLOR 15
LOCATE 2, 15: PRINT " Magazines "
LOCATE 3, 16: PRINT " Bullets "
LOCATE 5, 8: PRINT "Keys: (Case sensitive)"
COLOR 1
LOCATE 7, 9: PRINT "(w)-Stand"
LOCATE 8, 9: PRINT "(s)-Crouch"
LOCATE 9, 9: PRINT "(a)-Reload"
LOCATE 10, 9: PRINT "(d)-Fire"
COLOR 4
LOCATE 7, 23: PRINT "(8)-Stand"
LOCATE 8, 23: PRINT "(5)-Crouch"
LOCATE 9, 23: PRINT "(6)-Reload"
LOCATE 10, 23: PRINT "(4)-Fire"
COLOR 15
LOCATE 12, 8: PRINT "(ESC)-Back"
DO
LOOP UNTIL INKEY$ = CHR$(27)
LINE (45, 0)-(270, 120), 0, BF
CALL menu

50
END SUB

SUB Red


END SUB

SUB stats

COLOR 15
LOCATE 4, 7: PRINT "Statistics:"
LOCATE 6, 7: PRINT "Bullets Fired:"
LOCATE 7, 7: PRINT "Hits :"
LOCATE 8, 7: PRINT "Accuracy :"
COLOR 1
LOCATE 5, 21: PRINT "Blue"
LOCATE 6, 23: PRINT numofbullets
LOCATE 7, 23: PRINT numofhits
IF numofbullets > 0 THEN LOCATE 8, 23: PRINT INT(numofhits / numofbullets * 100); "%"
COLOR 4
LOCATE 5, 27: PRINT "Red"
LOCATE 6, 28: PRINT numofbullets1
LOCATE 7, 28: PRINT numofhits1
IF numofbullets1 > 0 THEN LOCATE 8, 28: PRINT INT(numofhits1 / numofbullets1 * 100); "%"
COLOR 15
LOCATE 10, 7: PRINT "(ANY KEY)- to continue"

SLEEP
CLS

END SUB

Quote
Like
Share

K3Y
Joined: May 15th, 2007, 11:02 pm

May 16th, 2007, 12:06 pm #7

Blue Guy:
"W": Stand
"S": Crouch
"D": Fire (only whilst standing)
"A": Reload (only whilst crouched)

Red Guy:
"8": Stand
"5": Crouch
"4": Fire (only whilst standing)
"6": Reload (only whilst crouched)
Quote
Like
Share

Joined: January 1st, 1970, 12:00 am

May 16th, 2007, 9:08 pm #8

DECLARE SUB drawworld ()
DECLARE SUB menu ()
DECLARE SUB stats ()
COMMON SHARED bullet, bullet1, mag, mag1, numofbullets, numofhits, numofbullets1, numofhits1
COMMON SHARED wounded, wounded1, bluecash, redcash, bluep, bluepmag, bluer, bluermag
COMMON SHARED redp, redpmag, redr, redrmag, twoplr
'Variable Key:
'mag
'bullet
'speed
'stance$
'stance
'wounded$
'wounded
'gotomenu
'bluecash
'redcash

SCREEN 13
RANDOMIZE TIMER
gotomenu = 1
5
RESET
CLS
mag = 10
mag1 = 10
bullet = 45
bullet1 = 45
bluecash = 500
redcash = 500
speed = 5
3
stance$ = "crouched"
stance1$ = "crouched"
stance = 0
stance1 = 0
wounded = 0
wounded1 = 0


IF gotomenu = 1 THEN gotomenu = 0: CALL menu
CALL drawworld
1

'Rifle
'PSET (240, 124), 1: DRAW "ta0 c8 bm-15,+0 m+10,+0 m-5,+5 bm+5,-5 m+5,+0 m+0,+5 bm+0,-5 m+10,+0 m+0,+5 m-10,-5 m+0,-2 m-10,+0 m+0,+2 ta0"

a$ = INKEY$

IF a$ = CHR$(27) THEN CALL menu

'2 player code

IF twoplr = 1 THEN
rndm = RND * 10
npcreacttime = npcreacttime - 1
IF npcreacttime < 0 THEN npcreacttime = 0

IF npcreacttime = 0 THEN
IF stance1$ = "crouched" AND rndm < .001 THEN npcreacttime = 1000: npc$ = "react stand"
IF stance1$ = "standing" AND rndm > 9.998 THEN npcreacttime = 1000: npc$ = "react crouch"

IF npc$ = "react stand" THEN a$ = "8": npc$ = ""
IF npc$ = "react crouch" THEN a$ = "5": npc$ = "": npcreacttime = 5000
IF npc$ = "reload" THEN a$ = "6": npc$ = ""
IF bullet1 < 15 THEN
IF stance1$ = "crouched" THEN npcreacttime = 1000: npc$ = "reload"
IF stance1$ = "standing" THEN npcreacttime = 1500: npc$ = "react crouch"
END IF

IF stance$ <> "crouched" THEN

IF npc$ = "react fire" THEN a$ = "4": npc$ = ""
IF stance1$ <> "standing" THEN
IF rndm > 5 AND bullet1 >= 15 THEN npcreacttime = 1000: npc$ = "react stand"
IF rndm < 5 THEN npcreacttime = 1000: npc$ = "react crouch"
END IF
IF stance1$ = "standing" AND bullet1 >= 15 AND stance$ = "standing" THEN npcreacttime = 1000: npc$ = "react fire"

END IF

END IF
IF fire > 0 AND rndm > 3 THEN npcreacttime = 500: npc$ = "react crouch"

END IF

'Change Stance

IF a$ = "s" AND stance$ <> "crouched" THEN stance$ = "standing to crouched": CIRCLE (69, 120), 3, 0: PAINT STEP(0, 0), 0: DRAW "bm-5,+5 m+10,+5 m+10,-5 m-1,-1 m+6,+0 bm-5,+1 m-10,+0 m-10,+0 m-5,+10 m+10,+5 m+0,+10 bm-20,+0 m+10,-5 m+0,-10": SOUND _
50, 1: GOTO skip
IF a$ = "w" AND stance$ <> "standing" THEN stance$ = "crouched to standing": CIRCLE (69, 130), 3, 0: PAINT STEP(0, 0), 0: DRAW "bm+5,+5 m-15,+0 m+5,-10 m+2,+1 m+0,-6 bm-2,+5 m+0,+10 m+10,+0 m-5,+10 m-10,-5 m-5,+10 bm+15,0 m-10,+0 m+10,-5": SOUND _
100, 1: GOTO skip
IF a$ = "5" AND stance1$ <> "crouched" THEN stance1$ = "standing to crouched": CIRCLE (246, 120), 3, 0: PAINT STEP(0, 0), 0: DRAW "bm+5,+5 m-10,+5 m-10,-5 m+1,-1 m-6,+0 bm+5,+1 m+10,+0 m+10,+0 m+5,+10 m-10,+5 m-0,+10 bm+20,+0 m-10,-5 m+0,-10": _
SOUND 150, 1: GOTO skip
IF a$ = "8" AND stance1$ <> "standing" THEN stance1$ = "crouched to standing": CIRCLE (246, 130), 3, 0: PAINT STEP(0, 0), 0: DRAW "bm-5,+5 m+15,+0 m-5,-10 m-2,+1 m-0,-6 bm+2,+5 m-0,+10 m-10,+0 m+5,+10 m+10,-5 m+5,+10 bm-15,0 m+10,+0 m-10,-5": _
SOUND 200, 1: GOTO skip
skip:

'*****BLUE*****

IF stance$ = "standing" THEN CIRCLE (69, 120), 3, 66: PAINT STEP(0, 0), 66: DRAW "c1 bm-5,+5 m+10,+5 c66 m+10,-5 c8 m-1,-1 m+6,+0 bm-5,+1 c66 m-10,+0 c1 m-10,+0 m-5,+10 m+10,+5 m+0,+10 bm-20,+0 m+10,-5 m+0,-10" _
': PSET (75, 124), 0: DRAW "ta0 c8 bm+15,+0 m-10,+0 m+5,+5 bm-5,-5 m-5,+0 m+0,+5 bm+0,-5 m-10,+0 m+0,+5 m+10,-5 m+0,-2 m+10,+0 m+0,+2 ta0"
IF stance$ = "crouched" THEN CIRCLE (69, 130), 3, 66: PAINT STEP(0, 0), 66: DRAW " c1 bm+5,+5 m-15,+0 c66 m+5,-10 c8 m+2,+1 m+0,-6 bm-2,+5 c66 m+0,+10 c1 m+10,+0 m-5,+10 m-10,-5 m-5,+10 bm+15,0 m-10,+0 m+10,-5" _
': PSET (75, 124), 0: DRAW "ta0 bm+15,+0 m-10,+0 m+5,+5 bm-5,-5 m-5,+0 m+0,+5 bm+0,-5 m-10,+0 m+0,+5 m+10,-5 m+0,-2 m+10,+0 m+0,+2 ta0"


IF stance$ = "crouched to standing" THEN
stance = stance + 1
CIRCLE (64, 125), 3, 66: PAINT STEP(0, 0), 66: DRAW "bm-5,+5 c1 m+10,+5 c66 m+5,-10 c8 m-1,-1 m+3,-5 bm-2,+6 c66 m-5,+5 c1 m-10,+0 m-5,+10 m+10,+0 m+5,+10 bm-20,+0 m+10,+0 m-5,-10"
IF stance > 500 THEN stance$ = "standing": CIRCLE (64, 125), 3, 0: PAINT STEP(0, 0), 0: DRAW "bm-5,+5 m+10,+5 m+5,-10 m-1,-1 m+3,-5 bm-2,+6 m-5,+5 m-10,+0 m-5,+10 m+10,+0 m+5,+10 bm-20,+0 m+10,+0 m-5,-10"
END IF

IF stance$ = "standing to crouched" THEN
stance = stance - 1: CIRCLE (64, 125), 3, 66: PAINT STEP(0, 0), 66: DRAW "bm-5,+5 c1 m+10,+5 c66 m+5,-10 c8 m-1,-1 m+3,-5 bm-2,+6 c66 m-5,+5 c1 m-10,+0 m-5,+10 m+10,+0 m+5,+10 bm-20,+0 m+10,+0 m-5,-10"
IF stance < 0 THEN stance$ = "crouched": CIRCLE (64, 125), 3, 0: PAINT STEP(0, 0), 0: DRAW "bm-5,+5 m+10,+5 m+5,-10 m-1,-1 m+3,-5 bm-2,+6 m-5,+5 m-10,+0 m-5,+10 m+10,+0 m+5,+10 bm-20,+0 m+10,+0 m-5,-10"
END IF

IF bullet < 15 AND a$ = "d" AND stance$ = "standing" AND fire <= 0 THEN SOUND 5000, 1
IF bullet >= 15 AND a$ = "d" AND stance$ = "standing" AND fire <= 0 THEN
numofbullets = numofbullets + 1
bullet = bullet - 5
fire = 100
IF bullet > 15 THEN PSET (30, bullet - 5): DRAW "c14 m+0,+2 m+0,-1 m+1,+0 ": LINE STEP(1, -1)-STEP(4, 2), 14, BF: LINE STEP(1, -2)-STEP(1, 2), 8, BF: PSET STEP(1, -1), 8
PSET (30, bullet), 0: DRAW "c0 m+0,+2 m+0,-1 m+1,+0 ": LINE STEP(1, -1)-STEP(4, 2), 0, BF: LINE STEP(1, -2)-STEP(1, 2), 0, BF: PSET STEP(1, -1), 0
END IF


IF fire > 0 THEN
IF fire > 50 THEN CIRCLE (94, 124), 5, 14: PAINT STEP(0, 0), 14: LINE STEP(0, 0)-STEP(20, 0), 14
IF fire < 50 THEN CIRCLE (94, 124), 5, 0: PAINT STEP(0, 0), 0: LINE STEP(0, 0)-STEP(20, 0), 0
IF fire <= speed THEN
PSET (RND * 15 + 300, RND * 20 + 115), 0: CIRCLE STEP(0, 0), 1, 7
luck = INT(RND * 100)
IF stance1$ = "standing" AND luck > 50 + (10 * wounded1) THEN
numofhits = numofhits + 1
wounded = wounded + 1
IF wounded = 1 THEN LOCATE 2, 28: COLOR 4: PRINT "Wounded"
IF wounded = 2 THEN LOCATE 3, 27: COLOR 4: PRINT "Critical"
FOR delay = 0 TO 20
SOUND delay * 100 + 50, .1
CIRCLE STEP(RND * 6 - 3, RND * 6 - 3), RND * 1, 4: PAINT STEP(0, 0), 4
NEXT
END IF
END IF
SOUND fire * 10 + 50, .05
SOUND 1000, .05
fire = fire - speed
IF wounded >= 3 THEN GOTO 2
END IF

IF a$ = "a" AND bullet < 25 AND stance$ = "crouched" AND mag > 0 THEN
FOR bullet = 10 TO 40 STEP 5
PSET (30, bullet): DRAW "c14 m+0,+2 m+0,-1 m+1,+0 ": LINE STEP(1, -1)-STEP(4, 2), 14, BF: LINE STEP(1, -2)-STEP(1, 2), 8, BF: PSET STEP(1, -1), 8
SOUND bullet * 50 + 50, .5
NEXT
mag = mag - 1
LOCATE 1, 4: COLOR 1: PRINT mag
END IF

IF mag = 0 AND bullet = 10 THEN GOTO 4


'*****RED*****

'*****Draw Stances*****

IF stance1$ = "standing" THEN CIRCLE (246, 120), 3, 66: PAINT STEP(0, 0), 66: DRAW "c4 bm+5,+5 m-10,+5 c66 m-10,-5 c8 m+1,-1 m-6,+0 bm+5,+1 c66 m+10,+0 c4 m+10,+0 m+5,+10 m-10,+5 m+0,+10 bm+20,+0 m-10,-5 m+0,-10"
IF stance1$ = "crouched" THEN CIRCLE (246, 130), 3, 66: PAINT STEP(0, 0), 66: DRAW " c4 bm-5,+5 m+15,+0 c66 m-5,-10 c8 m-2,+1 m+0,-6 bm+2,+5 c66 m+0,+10 c4 m-10,+0 m+5,+10 m+10,-5 m+5,+10 bm-15,0 m+10,+0 m-10,-5"

IF stance1$ = "crouched to standing" THEN
stance1 = stance1 + 1: CIRCLE (251, 125), 3, 66: PAINT STEP(0, 0), 66: DRAW "bm+5,+5 c4 m-10,+5 c66 m-5,-10 c8 m+1,-1 m-3,-5 bm+2,+6 c66 m+5,+5 c4 m+10,+0 m+5,+10 m-10,+0 m-5,+10 bm+20,+0 m-10,+0 m+5,-10"
IF stance1 > 500 THEN stance1$ = "standing": CIRCLE (251, 125), 3, 0: PAINT STEP(0, 0), 0: DRAW "bm+5,+5 m-10,+5 m-5,-10 m+1,-1 m-3,-5 bm+2,+6 m+5,+5 m+10,+0 m+5,+10 m-10,+0 m-5,+10 bm+20,+0 m-10,+0 m+5,-10"
END IF

IF stance1$ = "standing to crouched" THEN
stance1 = stance1 - 1
CIRCLE (251, 125), 3, 66: PAINT STEP(0, 0), 66: DRAW "bm+5,+5 c4 m-10,+5 c66 m-5,-10 c8 m+1,-1 m-3,-5 bm+2,+6 c66 m+5,+5 c4 m+10,+0 m+5,+10 m-10,+0 m-5,+10 bm+20,+0 m-10,+0 m+5,-10"
IF stance1 < 0 THEN stance1$ = "crouched": CIRCLE (251, 125), 3, 0: PAINT STEP(0, 0), 0: DRAW "bm+5,+5 m-10,+5 m-5,-10 m+1,-1 m-3,-5 bm+2,+6 m+5,+5 m+10,+0 m+5,+10 m-10,+0 m-5,+10 bm+20,+0 m-10,+0 m+5,-10"
END IF

'**********************

IF bullet1 < 15 AND a$ = "4" AND stance1$ = "standing" AND fire1 <= 0 THEN SOUND 5000, 1
IF bullet1 >= 15 AND a$ = "4" AND stance1$ = "standing" AND fire1 <= 0 THEN
accuracy1 = accuracy1 + 25
numofbullets1 = numofbullets1 + 1
bullet1 = bullet1 - 5
fire1 = 100
IF bullet1 > 15 THEN PSET (290, bullet1 - 5): DRAW "c14 m+0,+2 m+0,-1 m-1,+0 ": LINE STEP(-1, -1)-STEP(-4, 2), 14, BF: LINE STEP(-1, -2)-STEP(-1, 2), 8, BF: PSET STEP(-1, -1), 8
PSET (290, bullet1), 0: DRAW "c0 m+0,+2 m+0,-1 m-1,+0 ": LINE STEP(-1, -1)-STEP(-4, 2), 0, BF: LINE STEP(-1, -2)-STEP(-1, 2), 0, BF: PSET STEP(-1, -1), 0
END IF

IF fire1 > 0 THEN
IF fire1 > 50 THEN CIRCLE (220, 124), 5, 14: PAINT STEP(0, 0), 14: LINE STEP(0, 0)-STEP(-20, 0), 14
IF fire1 < 50 THEN CIRCLE (220, 124), 5, 0: PAINT STEP(0, 0), 0: LINE STEP(0, 0)-STEP(-20, 0), 0
IF fire1 <= speed THEN
PSET (RND * 15 + 5, RND * 20 + 115), 0: CIRCLE STEP(0, 0), 1, 7
luck = INT(RND * 100)
IF stance$ = "standing" AND luck > 50 + (10 * wounded) THEN
numofhits1 = numofhits1 + 1
wounded1 = wounded1 + 1
IF wounded1 = 1 THEN LOCATE 2, 7: COLOR 4: PRINT "Wounded"
IF wounded1 = 2 THEN LOCATE 3, 7: COLOR 4: PRINT "Critical"
FOR delay = 0 TO 20
SOUND delay * 200 + 50, .1
CIRCLE STEP(RND * 6 - 3, RND * 6 - 3), RND * 1, 4: PAINT STEP(0, 0), 4
NEXT
END IF
END IF
SOUND fire1 * 20 + 50, .05
SOUND 2000, .05
fire1 = fire1 - speed
IF wounded1 >= 3 THEN GOTO 2
END IF

IF a$ = "6" AND bullet1 < 25 AND stance1$ = "crouched" AND mag1 > 0 THEN
FOR bullet1 = 10 TO 40 STEP 5
PSET (290, bullet1): DRAW "c14 m+0,+2 m+0,-1 m-1,+0 ": LINE STEP(-1, -1)-STEP(-4, 2), 14, BF: LINE STEP(-1, -2)-STEP(-1, 2), 8, BF: PSET STEP(-1, -1), 8
SOUND bullet1 * 100 + 50, .5
NEXT
mag1 = mag1 - 1
LOCATE 1, 36: COLOR 4: PRINT mag1
END IF

IF mag1 = 0 AND bullet1 = 10 THEN GOTO 4

GOTO 1

2
LOCATE 1, 8
IF wounded > wounded1 THEN COLOR 1: PRINT "!! Blue wins + œ100 !!": mag = mag + 1'bluecash = bluecash + 100
IF wounded < wounded1 THEN COLOR 4: PRINT "!! Red wins + œ100 !!": mag1 = mag1 + 1'redcash = redcash + 100
FOR delay = 0 TO 5
IF wounded > wounded1 THEN SOUND 1000, .5: SOUND 1100, .5
IF wounded < wounded1 THEN SOUND 2000, .5: SOUND 2100, .5
NEXT
CLS
GOTO 3

4
FOR delay = 0 TO 10
LOCATE 10, 9
IF mag1 = 0 THEN COLOR 1: PRINT "!! BLUE WINS THE GAME !!": SOUND 1000, 1: SOUND 1100, 1
IF mag = 0 THEN COLOR 4: PRINT "!! RED WINS THE GAME !!": SOUND 2000, 1: SOUND 2100, 1
NEXT

LINE (45, 0)-(270, 120), 0, BF

gotomenu = 1

CALL stats
CALL menu
GOTO 5


SUB Blue

END SUB

SUB drawworld

'Draw World
CIRCLE (69, 130), 3, 66: PAINT STEP(0, 0), 66: DRAW " c1 bm+5,+5 m-15,+0 c66 m+5,-10 c8 m+2,+1 m+0,-6 bm-2,+5 c66 m+0,+10 c1 m+10,+0 m-5,+10 m-10,-5 m-5,+10 bm+15,0 m-10,+0 m+10,-5"
CIRCLE (246, 130), 3, 66: PAINT STEP(0, 0), 66: DRAW " c4 bm-5,+5 m+15,+0 c66 m-5,-10 c8 m-2,+1 m+0,-6 bm+2,+5 c66 m+0,+10 c4 m-10,+0 m+5,+10 m+10,-5 m+5,+10 bm-15,0 m+10,+0 m-10,-5"
LINE (0, 10)-STEP(25, 140), 31, BF
LINE (295, 10)-STEP(25, 140), 31, BF
LINE (0, 151)-(320, 200), 8, BF
LINE (75, 130)-STEP(20, 20), 6, BF
LINE (220, 130)-STEP(20, 20), 6, BF
LINE (28, 8)-STEP(13, 36), 8, B
LINE (279, 8)-STEP(13, 36), 8, B

'Load Magazines
oldbullet = bullet - 5
FOR bullet = 10 TO oldbullet STEP 5
PSET (30, bullet): DRAW "c14 m+0,+2 m+0,-1 m+1,+0 ": LINE STEP(1, -1)-STEP(4, 2), 14, BF: LINE STEP(1, -2)-STEP(1, 2), 8, BF: PSET STEP(1, -1), 8
SOUND bullet * 50 + 50, .5
NEXT

oldbullet1 = bullet1 - 5
FOR bullet1 = 10 TO oldbullet1 STEP 5
PSET (290, bullet1): DRAW "c14 m+0,+2 m+0,-1 m-1,+0 ": LINE STEP(-1, -1)-STEP(-4, 2), 14, BF: LINE STEP(-1, -2)-STEP(-1, 2), 8, BF: PSET STEP(-1, -1), 8
SOUND bullet1 * 100 + 50, .5
NEXT

'Print Text
LOCATE 1, 4: COLOR 1: PRINT mag
LOCATE 1, 35: COLOR 4: PRINT mag1

END SUB

SUB menu
COLOR 15
LOCATE 2, 18: PRINT "Menu"
LOCATE 4, 17: PRINT "2 Player"
LOCATE 5, 17: PRINT "1 Player"
LOCATE 6, 17: PRINT "Controls"
LOCATE 7, 17: PRINT "Quit"
LOCATE 9, 8: PRINT "(SPACE)-Select"

DO

LOCATE menu1 + 3, 16: COLOR 1: PRINT " ": LOCATE menu1 + 3, 25: COLOR 4: PRINT " "
LOCATE menu1 + 4, 16: COLOR 1: PRINT "*": LOCATE menu1 + 4, 25: COLOR 4: PRINT "*"
LOCATE menu1 + 5, 16: COLOR 1: PRINT " ": LOCATE menu1 + 5, 25: COLOR 4: PRINT " "
a$ = INKEY$
IF a$ = CHR$(0) + "P" THEN menu1 = menu1 + 1
IF a$ = CHR$(0) + "H" THEN menu1 = menu1 - 1
IF menu1 < 0 THEN menu1 = 0
IF menu1 > 3 THEN menu1 = 3
LOOP UNTIL a$ = CHR$(32)
LINE (45, 0)-(270, 110), 0, BF
IF menu1 = 0 THEN GOTO 50'RETURN
IF menu1 = 1 THEN twoplr = 1: GOTO 50
IF menu1 = 2 THEN GOTO menucontrols
IF menu1 = 3 THEN END

menucontrols:
COLOR 15
LOCATE 2, 15: PRINT " Magazines "
LOCATE 3, 16: PRINT " Bullets "
LOCATE 5, 8: PRINT "Keys: (Case sensitive)"
COLOR 1
LOCATE 7, 9: PRINT "(w)-Stand"
LOCATE 8, 9: PRINT "(s)-Crouch"
LOCATE 9, 9: PRINT "(a)-Reload"
LOCATE 10, 9: PRINT "(d)-Fire"
COLOR 4
LOCATE 7, 23: PRINT "(8)-Stand"
LOCATE 8, 23: PRINT "(5)-Crouch"
LOCATE 9, 23: PRINT "(6)-Reload"
LOCATE 10, 23: PRINT "(4)-Fire"
COLOR 15
LOCATE 12, 8: PRINT "(ESC)-Back"
DO
LOOP UNTIL INKEY$ = CHR$(27)
LINE (45, 0)-(270, 120), 0, BF
CALL menu

50
END SUB

SUB Red


END SUB

SUB stats

COLOR 15
LOCATE 4, 7: PRINT "Statistics:"
LOCATE 6, 7: PRINT "Bullets Fired:"
LOCATE 7, 7: PRINT "Hits :"
LOCATE 8, 7: PRINT "Accuracy :"
COLOR 1
LOCATE 5, 21: PRINT "Blue"
LOCATE 6, 23: PRINT numofbullets
LOCATE 7, 23: PRINT numofhits
IF numofbullets > 0 THEN LOCATE 8, 23: PRINT INT(numofhits / numofbullets * 100); "%"
COLOR 4
LOCATE 5, 27: PRINT "Red"
LOCATE 6, 28: PRINT numofbullets1
LOCATE 7, 28: PRINT numofhits1
IF numofbullets1 > 0 THEN LOCATE 8, 28: PRINT INT(numofhits1 / numofbullets1 * 100); "%"
COLOR 15
LOCATE 10, 7: PRINT "(ANY KEY)- to continue"

SLEEP
CLS

END SUB
Good concept, good icons, good use of randomizer in play.

I made a modularized version without GOTO and posted at
http://www.network54.com/Forum/178387/m ... 1179349319

The only change I made to the logic was to get rid of the money concept that wasn't used and instead, just focus on the clips.

But to speed up the game, I fixed it so when one player gets an additional clip, the other player loses one.

Otherwise, it seemed the games I played went on and on.

If you don't like people messing with your code to this extent, no problem: Just post "please delete" as a response here and I will delete this post plus the team version.

Mac

Quote
Like
Share

K3Y
Joined: May 15th, 2007, 11:02 pm

May 17th, 2007, 12:31 am #9

By all means, if you see anyway to improve the code go ahead. As long as nobody steals it I'm happy. I've picked up bad coding habits over the years so I'm looking to clean it up a little.

The money system is there because I was planing to add more weapons and such that the player could purchase but didn't get round to fully adding it in.

You've replaced the GOTO command with SUBs is that a quicker way of doing it in terms on coding? or just personal preference?

Additionally I would like to add sounds to it ... how would I go about doing that without using the annoying PC beep?
Quote
Like
Share

Joined: January 1st, 1970, 12:00 am

May 17th, 2007, 1:05 am #10

>You've replaced the GOTO command with SUBs is that a quicker way of doing it in terms on coding? or just personal preference?

If you study the code and get used to structured programming, you will be able to write much more complicated programs, even with other people contributing SUB's, etc. So I think it is more than personal preference.


> I would like to add sounds to it ... how would I go about doing that without using the annoying PC beep?

Make a post to that effect on the main forum:
http://www.network54.com/Forum/13959/

In it, include a reference to
http://www.network54.com/Forum/178387/m ... 1179349319

I don't know the answer, but someone will, I'm sure.

Mac
Quote
Like
Share