Guest User

Double jump issue

a guest
Oct 20th, 2024
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | Gaming | 0 0
  1. var jump_buffer_counter = 0
  2. var cayote_counter = 0
  3.  
  4. @export var jump_buffer_time = 15
  5. @export var cayote_time = 15
  6.  
  7. func _physics_process(delta):
  8. If is_on_floor():
  9. cayote_counter = cayote_time
  10. If ! is_on_floor():
  11. If cayote_counter > 0
  12. cayote_counter -= 1
  13. Velocity.y += gravity*delta
  14. If Input. is_action_pressed("jump"):
  15. jump_buffer_counter = jump_buffer_time
  16. If jump_buffer_counter > 0:
  17. jump_buffer_coumter -= 1
  18. If jump_buffer_counter > 0 and cayote_counter > 0:
  19. velocity.y = jump_force
  20. jump_buffer_counter = 0
  21. cayote_counter = 0
Add Comment
Please, Sign In to add comment