Have you ever encountered that frustrating scenario where you're sprinting toward the platform's edge, fully aware that you need to jump, and you indeed press the A button at the very last moment, but still find yourself plummeting? It's as though the game failed to acknowledge your input. What an exasperating experience!
It's precisely for this particular situation that modern games incorporate the "coyote time," allowing the jump button to be registered a few frames after your character has left the platform. This not only enhances the gameplay experience but also fosters a greater sense of fairness.
In this tutorial, I will explain a straightforward method to implement the "coyote time" feature in your platformer game:
(the Player can still jump a few frames after leaving the platform)
0) BACKUP YOUR PROJECT (optional but important)
Before every big modification, new feature implementation, in your project, it's very important to backup your NESmaker project.
Select the NESmaker folder and copy/paste it. Then rename the new folder adding today's date for example.
1) COYOTE TIMER VARIABLE
In the "Project Settings > User Variables", add a "coyoteTimer" with an initial value "0":
2) HANDLE GAME TIMER
In the "Project Settings > Script Settings", edit the Handle Game Timer script and add that block of code:
Note: if your Handle Game Timer is blank, you can either create a new script and assign it to the Handle Game Timer element... or choose to add that code in the "Sprite Post-draw" or "Sprite Pre-draw" instead of the "Handle Game Time" script.
3) COYOTE TIMER PHYSICS
In the "Project Settings > Script Settings", edit the Handle Physics script, locate the "isSolidSoLand:" line (near the end of the script)... and just AFTER that line, add that block of code:
Your script should look like that, now:
Note: of course, I used 06 (frames) because it feels good for my project. You can try different small values to see how it feels.
4) JUMP ON COYOTE TIMER
Lastly, in your Scripts > Input Scripts, edit your Jump input script, locate the "JMP +skipJumping" line (near the last part of the script) and just BEFORE that line, add:
Your code should look like that, now:
Voilà, now you the last second jump should feel better!
Don't hesitate to tweak that feature for your needs (the code we added in the Physics, the “#$06" can be adjusted as you want).
Also, maybe some initializations (LDA #$00 STA coyoteTimer will be needed in your handle hurt script or in the handle screen loads... you'll see, depending of your projects)
It's precisely for this particular situation that modern games incorporate the "coyote time," allowing the jump button to be registered a few frames after your character has left the platform. This not only enhances the gameplay experience but also fosters a greater sense of fairness.
In this tutorial, I will explain a straightforward method to implement the "coyote time" feature in your platformer game:
(the Player can still jump a few frames after leaving the platform)
0) BACKUP YOUR PROJECT (optional but important)
Before every big modification, new feature implementation, in your project, it's very important to backup your NESmaker project.
Select the NESmaker folder and copy/paste it. Then rename the new folder adding today's date for example.
1) COYOTE TIMER VARIABLE
In the "Project Settings > User Variables", add a "coyoteTimer" with an initial value "0":
2) HANDLE GAME TIMER
In the "Project Settings > Script Settings", edit the Handle Game Timer script and add that block of code:
Code:
LDA coyoteTimer
BEQ +continue
DEC coyoteTimer
+continue:
Note: if your Handle Game Timer is blank, you can either create a new script and assign it to the Handle Game Timer element... or choose to add that code in the "Sprite Post-draw" or "Sprite Pre-draw" instead of the "Handle Game Time" script.
3) COYOTE TIMER PHYSICS
In the "Project Settings > Script Settings", edit the Handle Physics script, locate the "isSolidSoLand:" line (near the end of the script)... and just AFTER that line, add that block of code:
Code:
CPX player1_object
BNE +skip
LDA #$06 ;; here, the delay of the Coyote Time
STA coyoteTimer
+skip:
Your script should look like that, now:
Note: of course, I used 06 (frames) because it feels good for my project. You can try different small values to see how it feels.
4) JUMP ON COYOTE TIMER
Lastly, in your Scripts > Input Scripts, edit your Jump input script, locate the "JMP +skipJumping" line (near the last part of the script) and just BEFORE that line, add:
Code:
LDA coyoteTimer
BEQ +continue
LDA #$00
STA coyoteTimer
JMP +doJump
+continue:
Your code should look like that, now:
Voilà, now you the last second jump should feel better!
Don't hesitate to tweak that feature for your needs (the code we added in the Physics, the “#$06" can be adjusted as you want).
Also, maybe some initializations (LDA #$00 STA coyoteTimer will be needed in your handle hurt script or in the handle screen loads... you'll see, depending of your projects)
Last edited: