I have been working on a simple single-screen "fight the enemies" game recently, and previously it's worked fairly well. However, I have now encountered some problems.
The conditions: Everything is slippery, including three operational platforms. This should not change.
The problems: The player simply refuses to move left, and either he can't jump at all (which makes platforms irrelevant) or else can jump in mid-air (which reminds me of a code for Super Mario Bros. 3 called Multi-Jumps)... as many times as he wants.
The relevant code:
Left and right (on slippery surfaces):
The jump code:
Explanation: JUMP seems stuck at 4, player\dnru at 1; thus, were I to put in code to ignore Up he wouldn't jump at all. Also, he turns left but doesn't move left, almost as if it were keeping player\xv at 0. He has moved left and right before; he just doesn't now.
The basic question: Why aren't JUMP and player\dnru changing?
Thanks in advance to everyone with answers or ideas.
The conditions: Everything is slippery, including three operational platforms. This should not change.
The problems: The player simply refuses to move left, and either he can't jump at all (which makes platforms irrelevant) or else can jump in mid-air (which reminds me of a code for Super Mario Bros. 3 called Multi-Jumps)... as many times as he wants.
The relevant code:
Left and right (on slippery surfaces):
If KeyDown(RIGHTKEY) player\xv = player\xv + 1 player\direction = DIRECTIONRIGHT player\frame = (player\frame + 1)Mod (8) + (8 * player\direction - 8) ElseIf KeyDown(LEFTKEY) player\xv = player\xv - 1 player\direction = DIRECTIONLEFT player\frame = (player\frame + 1)Mod (8) + (8 * player\direction - 8) Else If player\xv > 0 player\xv = player\xv - 1 ElseIf player\xv < 0 player\xv = player\xv + 1 EndIf EndIf If player\xv > player\maxxv ;This is positive player\xv = player\maxxv ElseIf player\xv < player\minxv ;... and this negative player\xv = player\minxv EndIf player\x = player\x + player\xv ;This to actually move him If player\x < 20 player\x = 20 ElseIf player\x > 780 player\x = 780 EndIf
The jump code:
If KeyHit(UPKEY) player\dnru = 1 JUMP = 4 GRAVITY = 0 EndIf If JUMP = 4 JUMP = 4 If player\xv = 0 player\xv = 1 EndIf player\y = player\y - MOVEY + GRAVITY GRAVITY = GRAVITY + 1 EndIf If player\y > 482 player\y = 482 EndIf If player\y >= 482 player\dnru = 0 JUMP = 0 GRAVITY = MOVEY EndIf
Explanation: JUMP seems stuck at 4, player\dnru at 1; thus, were I to put in code to ignore Up he wouldn't jump at all. Also, he turns left but doesn't move left, almost as if it were keeping player\xv at 0. He has moved left and right before; he just doesn't now.
The basic question: Why aren't JUMP and player\dnru changing?
Thanks in advance to everyone with answers or ideas.