qbasicking
Programmer
This code below is for switching weapons in a first person shooter game, it works perfectly...once, then it won't switch again.
I have run check after check on this code, but I can't figure out the problem.
PRINT kbmatrix%(29), special%
IF kbmatrix%(29) AND special% THEN
PRINT "It works!"
a% = spriteph%(special2%)
sprites%(special2%) = weapon%
spritex(special2%) = px
spritey(special2%) = py
spriteph%(special2%) = shots%
weapon% = special%
shots% = a%
END IF
This is the output I get:
---------------------------------
|1 6 |
| |
| |
| |
| |
| |
| |
| |
---------------------------------
Since kbmatrix%(26) = 1 and special% = 6 it should also print "It works!", but I doesn't this seems to contredict basic boolean algebra, could someone tell me whats going on and how to fix it?
FYI:
special% is the type of weapon you are switching to
special2% is the number for the sprite
I have run check after check on this code, but I can't figure out the problem.
PRINT kbmatrix%(29), special%
IF kbmatrix%(29) AND special% THEN
PRINT "It works!"
a% = spriteph%(special2%)
sprites%(special2%) = weapon%
spritex(special2%) = px
spritey(special2%) = py
spriteph%(special2%) = shots%
weapon% = special%
shots% = a%
END IF
This is the output I get:
---------------------------------
|1 6 |
| |
| |
| |
| |
| |
| |
| |
---------------------------------
Since kbmatrix%(26) = 1 and special% = 6 it should also print "It works!", but I doesn't this seems to contredict basic boolean algebra, could someone tell me whats going on and how to fix it?
FYI:
special% is the type of weapon you are switching to
special2% is the number for the sprite