From b44f2d5dfcc3897fc85931e5e2afb3f2e42ee7d6 Mon Sep 17 00:00:00 2001 From: ronaldo Date: Wed, 24 Jul 2019 00:13:26 +0200 Subject: [PATCH] BASIC: Enemy movements and hit probabilities --- basic/rpg.bas | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/basic/rpg.bas b/basic/rpg.bas index 9666b5b..06ba725 100644 --- a/basic/rpg.bas +++ b/basic/rpg.bas @@ -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 @@ -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 @@ -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