Absolutely NOTHING about coyote jumping or any of your game logic should care where the input comes from.
Separating input concerns from game logic concerns:
- make variables to represent possible player input intent
Each frame:
-
gather input:
→ clear those intents
→ load input into those variables from input sources <---- this is the ONLY part that cares where the input comes from -
process input from those variables: (note how NONE of this cares where the input came from)
→ movement
→ jumping (regular, coyote, whatever)
→ shoot bullets?
→ change weapons?
→ other???
All games should use this approach. Unfortunately far too many tutorials commingle the input and the processing, making it very hard to retrofit other input sources.
Here is an example of the above:
Look for functions called UpdateGatherInputs()
and those beginning with Process*
Full source at:
proximity_buttons is presently hosted at these locations: