Qbasicnews.com
March 21, 2019, 07:14:35 PM
 Pages: [1]
 Author Topic: I'm creating an FPS game....  (Read 1408 times)
Coyote
New Member

Posts: 1

 « on: October 21, 2004, 11:05:57 PM »

pretty weird right now

Problems:

1. enemy moves with stickman

2. Enemy makes actions too fast

======================================

RANDOMIZE TIMER
SCREEN 12: CLS

PRINT "(press a key)"
SLEEP 9999
CLS

he = 100
a = 100
sc = 0
m = 40

DEFINT A-Z
DIM Mouse(1000)

GET (130, 160)-(100, 100), Mouse

FOR x = 0 TO 0
FOR y = 0 TO 0
IF POINT(x, y) = 0 THEN PSET (x, y), 15 ELSE PSET (x, y), 0
NEXT y
NEXT x

x = 300: y = 300
PUT (x, y), Mouse, OR

a = 100
he = 100
sc = 0
m = 40

n% = 10
DO
NextCheck! = TIMER
DO
NextCheck2! = TIMER
Key\$ = UCASE\$(INKEY\$)

IF ABS(NextCheck! - NextCheck2!) >= 1.5 THEN GOSUB 1080: NextCheck! = TIMER

IF LEN(Key\$) = 2 THEN IF INSTR("HPMK", MID\$(Key\$, 2, 1)) <> 0 OR Key\$ = CHR\$(27) OR Key\$ = CHR\$(32) THEN EXIT DO

LOOP WHILE Key\$ = ""

SELECT CASE Key\$
CASE CHR\$(0) + "H" 'UP
IncY = -n%: IncX = 0
CASE CHR\$(0) + "P" 'DOWN
IncY = n%: IncX = 0
CASE CHR\$(0) + "K" 'LEFT
IncX = -n%: IncY = 0
CASE CHR\$(0) + "M" 'RIGHT
IncX = n%: IncY = 0
CASE CHR\$(27) 'ESCAPE KEY
SYSTEM
END SELECT

IF Key\$ = CHR\$(61) THEN
he = (he - 10)
PAINT (100, 100), 4
LOCATE 15, 38
PRINT "OUCH"
COLOR 15
PAINT (100, 100), 0
END IF

IF he < 10 AND Key\$ = CHR\$(75) THEN
PAINT (100, 100), 4
LOCATE 15, 38
PRINT "Noooo"
COLOR 15
PAINT (100, 100), 0
END IF

IF m > 0 AND Key\$ = CHR\$(50) THEN
LOCATE 27, 60
PRINT "Bought ammo!"
SLEEP 1
END IF

IF m > 0 AND Key\$ = CHR\$(49) THEN
LOCATE 27, 60
PRINT "Bought a medikit!"
SLEEP 1
END IF

IF m > 0 AND Key\$ = CHR\$(49) THEN
he = (he + 20)
m = (m - 200)
END IF

IF m < 0 AND Key\$ = CHR\$(49) THEN
LOCATE 27, 60
he = (he - 20)
m = (m + 200)
COLOR 4
PRINT "Not enough money!"
COLOR 15
SLEEP 1
END IF

IF m > 0 AND Key\$ = CHR\$(50) THEN
a = (a + 50)
m = (m - 300)
END IF

IF m < 0 AND Key\$ = CHR\$(50) THEN
LOCATE 27, 60
a = (a - 50)
m = (m + 300)
COLOR 4
PRINT "Not enough money!"
COLOR 15
SLEEP 1
END IF

IF Key\$ = CHR\$(32) THEN
a = (a - 1)
scale\$ = "C"
PLAY "L16"
FOR i% = 1 TO 1
PLAY "O" + STR\$(i%)
PLAY "X" + VARPTR\$(scale\$)
NEXT i%
IncY = n%: IncX = 0
IncY = -n%: IncX = 0
END IF

IF Key\$ = CHR\$(71) THEN
LOCATE 27, 60
PRINT "FIRE IN THE HOLE!"
a = (a - 5)
scale\$ = "DC"
PLAY "L16"
FOR i% = 1 TO 1
PLAY "O" + STR\$(i%)
PLAY "X" + VARPTR\$(scale\$)
NEXT i%
GOTO 12000
30000
SLEEP
END IF

IF x = 340 AND y = 220 AND Key\$ = CHR\$(32) OR Key\$ = CHR\$(71) THEN
COLOR 3
LOCATE 27, 60
sc = (sc + 1)
m = (m + 10)
PRINT "Got him"
COLOR 15
END IF

'Check for screen boundaries and reset increments to zero if overrun
IF IncX = -n% AND x <= 10 + n% THEN IncX = 0
IF IncX = n% AND x >= 600 - n% THEN IncX = 0
IF IncY = -n% AND y <= 10 + n% THEN IncY = 0
IF IncY = n% AND y >= 400 - n% THEN IncY = 0
WAIT &H3DA, 8
WAIT &H3DA, 8, 8 'wait for vertical retrace
x = x + IncX: IF Key\$ <> CHR\$(32) THEN y = y + IncY 'Adjust sprite position
CLS 1

X1 = 1: y1 = 1
x2 = 20: y2 = 12

PUT (x, y), Mouse, OR

Target\$ = "BD13"
DRAW "C4 X" + VARPTR\$(Target\$)
DRAW "U20 BU10 U20 D20 BD5 BL3 L20 R20 BR5 R20"

LOCATE 25, 25
PRINT "--------------------------------------------------------------------------------"
PRINT "HEALTH:"; he; " "; " AMMO:"; a; " SCORE:"; sc; " MONEY:"; m

IF a <= 0 THEN
COLOR 4
LOCATE 27, 60
PRINT "OUT OF AMMO'D!"
COLOR 15
LOCATE 27, 15
COLOR 4
PRINT "AMMO: "
COLOR 15
SLEEP 3
CLS
PRINT "Your score was: ", sc
COLOR 15
SLEEP 2
INPUT "Play again? (Y or N) ", play\$
END IF

IF a <= 10 THEN
COLOR 12
LOCATE 27, 60
PRINT "Low ammo!"
COLOR 15
LOCATE 27, 15
COLOR 12
PRINT "AMMO: "
COLOR 15
END IF

IF he <= 10 THEN
COLOR 4
LOCATE 13, 36
PRINT "Prepare to die!"
COLOR 15
LOCATE 27, 1
COLOR 12
PRINT "HEALTH:"
COLOR 15
END IF

IF he <= 0 THEN
GOTO 8000
9000
SLEEP 3
CLS
PRINT "Your score was: ", sc
PRINT
SLEEP 2
RIP\$ = ""
DRAW "C8 X" + VARPTR\$(RIP\$)
DRAW "U80 E20 R30 F20 D80 L70 BE20 BU30 U30 R5 F5 D5 G10 F10 BR10 U20 BR10 D30 BU30 R10 D10 L10"
PRINT
COLOR 15
INPUT "Play again? (Y or N) ", play\$
END IF
IF play\$ = "Y" THEN
CLS
PRINT "Try again"
SLEEP 2
RUN "CURSOR.BAS"
END IF

IF play\$ = "N" THEN
CLS
COLOR 15
PRINT "Good Bye, QUITTER"
END
END IF

1080
SEL% = SEL% + 1

IF SEL% = 1 THEN
Man\$ = "BL100"
DRAW "C1 X" + VARPTR\$(Man\$)
DRAW "E20 F20 H20 U20 R20 L40 R20 U7 H1 L1 H1 L1 H1 L1 H1 L1 U4 E1 E1 E1 R8 F1 F1 F1 D4 L1 D1 L1 D1 L1 D1 L1 D1 L1 C4 BU18 BL1 BD9 D1"
SLEEP 1
END IF

IF SEL% = 2 THEN
Man\$ = "BD100"
DRAW "C1 X" + VARPTR\$(Man\$)
DRAW "E20 F20 H20 U20 R20 L40 R20 U7 H1 L1 H1 L1 H1 L1 H1 L1 U4 E1 E1 E1 R8 F1 F1 F1 D4 L1 D1 L1 D1 L1 D1 L1 D1 L1 C4 BU18 BL1 BD9 D1"
SLEEP 1
END IF

IF SEL% = 3 THEN
Man\$ = "BR100"
DRAW "C1 X" + VARPTR\$(Man\$)
DRAW "E20 F20 H20 U20 R20 L40 R20 U7 H1 L1 H1 L1 H1 L1 H1 L1 U4 E1 E1 E1 R8 F1 F1 F1 D4 L1 D1 L1 D1 L1 D1 L1 D1 L1 C4 BU18 BL1 BD9 D1"
END IF

IF SEL% = 4 THEN
he = (he - 5)
PAINT (100, 100), 4
LOCATE 15, 37: PRINT " OUCH "
COLOR 15
LOCATE 15, 37: PRINT " "
PAINT (100, 100), 0
END IF

IF SEL% = 5 THEN
LOCATE 27, 60
COLOR 4
SLEEP 1
he = (he - 10)
PAINT (100, 100), 15
LOCATE 15, 37: PRINT " ARGH! "
COLOR 15
LOCATE 15, 37: PRINT " "
PAINT (100, 100), 0
END IF

IF SEL% = 6 THEN
SEL% = 0

END IF

LOOP

12000
CIRCLE (x, y), 1, 14
CIRCLE (x, y), 2, 4
CIRCLE (x, y), 3, 14
CIRCLE (x, y), 4, 4
CIRCLE (x, y), 5, 14
CIRCLE (x, y), 6, 4
CIRCLE (x, y), 7, 14
CIRCLE (x, y), 8, 4
CIRCLE (x, y), 9, 14
CIRCLE (x, y), 10, 4
CIRCLE (x, y), 11, 14
CIRCLE (x, y), 12, 4
CIRCLE (x, y), 13, 14
CIRCLE (x, y), 14, 4
CIRCLE (x, y), 15, 14
CIRCLE (x, y), 16, 4
CIRCLE (x, y), 17, 14
CIRCLE (x, y), 18, 4
CIRCLE (x, y), 19, 14
CIRCLE (x, y), 20, 4
CIRCLE (x, y), 21, 14
CIRCLE (x, y), 22, 4
CIRCLE (x, y), 23, 14
CIRCLE (x, y), 24, 4
CIRCLE (x, y), 25, 14
CIRCLE (x, y), 26, 4
CIRCLE (x, y), 27, 14
CIRCLE (x, y), 28, 4
CIRCLE (x, y), 29, 14
CIRCLE (x, y), 30, 4
CIRCLE (x, y), 31, 14
CIRCLE (x, y), 32, 4
CIRCLE (x, y), 33, 14
CIRCLE (x, y), 34, 4
CIRCLE (x, y), 35, 14
CIRCLE (x, y), 36, 4
CIRCLE (x, y), 37, 14
CIRCLE (x, y), 38, 4
CIRCLE (x, y), 39, 14
CIRCLE (x, y), 40, 4
CIRCLE (x, y), 41, 14
CIRCLE (x, y), 42, 4
CIRCLE (x, y), 43, 14
CIRCLE (x, y), 44, 4
CIRCLE (x, y), 45, 14
CIRCLE (x, y), 46, 4
CIRCLE (x, y), 47, 14
CIRCLE (x, y), 48, 4
CIRCLE (x, y), 49, 14
CIRCLE (x, y), 50, 4
CIRCLE (x, y), 51, 14
CIRCLE (x, y), 52, 4
CIRCLE (x, y), 53, 14
CIRCLE (x, y), 54, 4
CIRCLE (x, y), 55, 14
CIRCLE (x, y), 56, 4
CIRCLE (x, y), 57, 14
CIRCLE (x, y), 58, 4
CIRCLE (x, y), 59, 14
CIRCLE (x, y), 60, 4
CIRCLE (x, y), 61, 14
CIRCLE (x, y), 62, 4
CIRCLE (x, y), 63, 14
CIRCLE (x, y), 64, 4
CIRCLE (x, y), 65, 14
CIRCLE (x, y), 66, 4
CIRCLE (x, y), 67, 14
CIRCLE (x, y), 68, 4
CIRCLE (x, y), 69, 14
CIRCLE (x, y), 70, 4
CIRCLE (x, y), 71, 14
CIRCLE (x, y), 72, 4
CIRCLE (x, y), 73, 14
CIRCLE (x, y), 74, 4
CIRCLE (x, y), 75, 14
CIRCLE (x, y), 76, 4
CIRCLE (x, y), 77, 14
CIRCLE (x, y), 78, 4
CIRCLE (x, y), 79, 14
CIRCLE (x, y), 80, 4
CIRCLE (x, y), 85, 8
CIRCLE (x, y), 90, 8
CIRCLE (x, y), 95, 8
GOTO 30000

8000
CLS
SLEEP 1
PAINT (100, 100), 4
LOCATE 15, 38
COLOR 15
PAINT (100, 100), 0
PAINT (100, 100), 4
LOCATE 15, 38
COLOR 15
PAINT (100, 100), 0
PAINT (100, 100), 4
LOCATE 15, 38
COLOR 15
PAINT (100, 100), 0
PAINT (100, 100), 4
LOCATE 15, 38
COLOR 15
PAINT (100, 100), 0
PAINT (100, 100), 4
LOCATE 15, 38
COLOR 15
PAINT (100, 100), 0
PAINT (100, 100), 4
LOCATE 15, 38
COLOR 15
PAINT (100, 100), 0
PAINT (100, 100), 4
LOCATE 15, 38
COLOR 15
PAINT (100, 100), 0
PAINT (100, 100), 4
LOCATE 15, 38
COLOR 15
PAINT (100, 100), 0
PAINT (100, 100), 4
LOCATE 15, 38
COLOR 15
PAINT (100, 100), 0
PAINT (100, 100), 4
LOCATE 15, 38
COLOR 15
PAINT (100, 100), 0
PAINT (100, 100), 4
LOCATE 15, 38
COLOR 15
PAINT (100, 100), 0
PAINT (100, 100), 4
LOCATE 15, 38
COLOR 15
PAINT (100, 100), 0
PAINT (100, 100), 4
LOCATE 15, 38
COLOR 15
PAINT (100, 100), 0
PAINT (100, 100), 4
LOCATE 15, 38
COLOR 15
PAINT (100, 100), 0
PAINT (100, 100), 4
LOCATE 15, 38
COLOR 15
PAINT (100, 100), 0
PAINT (100, 100), 4
LOCATE 15, 38
COLOR 15
PAINT (100, 100), 0
PAINT (100, 100), 4
LOCATE 15, 38
COLOR 15
PAINT (100, 100), 0
PAINT (100, 100), 4
LOCATE 15, 38
COLOR 15
PAINT (100, 100), 0
PAINT (100, 100), 4
LOCATE 15, 38
COLOR 15
PAINT (100, 100), 0
PAINT (100, 100), 4
LOCATE 15, 38
COLOR 15
PAINT (100, 100), 0
PAINT (100, 100), 4
LOCATE 15, 38
COLOR 15
PAINT (100, 100), 0
PAINT (100, 100), 4
LOCATE 15, 38
COLOR 15
PAINT (100, 100), 0
PAINT (100, 100), 4
LOCATE 15, 38
COLOR 15
PAINT (100, 100), 0
PAINT (100, 100), 4
LOCATE 15, 38
PRINT "You have died."
COLOR 15
PAINT (100, 100), 0
RIP\$ = ""
DRAW "C8 X" + VARPTR\$(RIP\$)
DRAW "U80 E20 R30 F20 D80 L70 BE20 BU30 U30 R5 F5 D5 G10 F10 BR10 U20 BR10 D30 BU30 R10 D10 L10"
LOCATE 15, 38
SLEEP 2
GOTO 9000
 Logged

o.
 Pages: [1]