PeskyBird 2022-04-17 02:02
For some reason, whenever I use this code for calculating and dealing damage to the player, it sets the HP of the player from 100 to 900 before subtracting damage. Any idea why and how to fix it?
ELSE IF TURN=1 THEN
TEXT 0,15,"GREYBEARD ATTACKS! "
IF EDEAL <> 7 THEN
IF ECRIT>89 THEN
TEXT 0,15,"IT'S A CRITICAL HIT! "
TEXT 0,15,"GREYBEARD HIT! "
ELSE IF EDEAL = 7 THEN
TEXT 0,15,"GREYBEARD MISSED! "
nathanielbabiak 2022-04-17 03:42
This code doesn't do that. I'll take a look if you upload the whole file.
You can upload the whole file by editing your post (you can't upload a file to a new post, only an edited post).
Timo 2022-04-17 08:14
Maybe it’s just a visual bug: if you TEXT/PRINT “90” on top of “100”, you will still see the last “0” of “100”.
If this is the case you can either clear that screen area before, or use the NUMBER command to always get the same number of digits.
was8bit 2022-04-17 09:24
Alternatively, TEXT X,Y,STR$(HP)+" " will also clear away the extra 0 off of the original "100"
was8bit 2022-04-17 09:25
You can also use TRACE HP and when testing your game, turn your DEBUG mode on, and this lets you see what HP is in real time, without relying on printing it to the screen with normal code...
PeskyBird 2022-04-17 11:09
Ok I didn’t think of the extra zero from the 100. Thanks for the help!
was8bit 2022-04-17 14:36
If you haven't use TRACE yet, i would strongly recommend it... it has helped me find things i wouldnt be able to find otherwise... ;)
was8bit 2022-04-17 14:39 (Edited)
Another trick is to add something like PLAY 3,90,10 ... place this inside an IF statement to test whether or not the code inside an IF statement is being executed or not.. it beeps if it is, it remains silent if it isnt... ;)