Skip to content

Commit

Permalink
BASIC: Enemy movements and hit probabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
lronaldo committed Jul 23, 2019
1 parent aaa2148 commit b44f2d5
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions basic/rpg.bas
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@

1 ' INITIALIZE
100 DEFINT a-z
110 e=100:a=30:d=15:x=5
120 ee=90:ea=20:ed=10:ex=7:a$=""
110 e=100:a=30:d=15:x=5:f=0
120 ee=90:ea=20:ed=10:ex=7:en=0:a$=""
130 DIM em(3):em(0)=-1:em(1)=1:em(2)=1:em(3)=-1
140 DEF FNr(m)=m-3+(RND*6)

1 ' PRESENTATION
200 MODE 1:PRINT"RPG GAME"
210 GOSUB 10000
210 GOSUB 10000:RANDOMIZE TIME

1 ' PRINT GAME STATUS
300 WHILE 1:CLS
Expand All @@ -28,7 +30,7 @@
430 IF a$="D" THEN GOSUB 1400:GOTO 500
450 GOTO 400

1 ' ENEMY ACTIONS
1 ' ENEMY ACTIONS: ATTACK or MOVE
500 IF ex=x+1THEN GOSUB 1200 ELSE GOSUB 1300

900 GOSUB 10000:WEND
Expand All @@ -38,19 +40,19 @@
1010 RETURN

1 ' MOVE PLAYER RIGHT
1100 x=x+1:IF x=ex THEN x=x-1:ee=ee-a:PRINT"PLAYER ATTACKS WITH FORCE:"a
1100 x=x+1:IF x=ex THEN x=x-1:f=FNr(a):ee=ee-f:PRINT"PLAYER ATTACKS WITH FORCE:"f
1110 RETURN

1 ' ENEMY ATTACKS
1200 e=e-ea:PRINT"ENEMY ATTACKS WITH FORCE:"ea
1200 f=FNr(ea):e=e-f:PRINT"ENEMY ATTACKS WITH FORCE:"f
1210 RETURN

1 ' ENEMY DEFENDS
1300 ee=ee+ed:PRINT"ENEMY RELOADS:"ed
1 ' ENEMY MOVES
1300 ex=ex+em(en):en=en+1:IF en=4THEN en=0
1310 RETURN

1 ' PLAYER DEFENDS
1400 e=e+d:PRINT"PLAYER RELOADS:"d
1400 f=FNr(d):e=e+f:PRINT"PLAYER RELOADS:"f
1410 RETURN

1 ' PRESS ENTER TO CONTINUE
Expand Down

0 comments on commit b44f2d5

Please sign in to comment.