Godot Version
v4.5 stable
Question
don't even know how to ask this :O
[USING LINUX MINT]
I am a Godot newbie so it is entirely possible that this is user error, but all three of my overclocked brain-cells think this is a bug.
I was trying to make a FPS game in Godot and wanted to implement coyote time in blender,(letting the character jump for a few milliseconds after falling off a ledge)
so I use the timer node, basically i want timer to start the second player leaves a floor (falls off a ledge) if the player presses space before the timer ends the jump registers and doesn’t if player was too late to start.
however the code written below let’s me jump after way after one second from the player falling.
[trying to debug my problem you can see the now commented code where i asked it to print wait time, and time left when coyote jump happened both outputs gave me the exact same number, the number was the one i set in timer properties through UI (example- 2.873 seconds) instead of the value of ‘cayote_timer’ variable]
(also I didn’t know how to spell coyote till typing this post sorri :D)
@onready var timer: Timer = $Timer
@export var cayote_timer = 1
var jump_permission = 1
var jump_permission_reset = 1
func _physics_process(delta: float) -> void:
# Add the gravity.
if not is_on_floor():
velocity += get_gravity() * delta * gravitymult
timer.start(cayote_timer)
# Handle jump.
if is_on_floor():
jump_permission = jump_permission_reset
if Input.is_action_just_pressed("ui_accept"):
if player.is_on_floor() or jump_permission > 0:
jump(JUMP_VELOCITY)
print("jumped")
$"ConvertedByVirtualSp eech-Imqpu0o6h2".play()
#if player.is_on_floor():
#jump(JUMP_VELOCITY)
#print("jumped")
#if !player.is_on_floor() and timer.time_left > 0:
# print("time left = ", timer.time_left)
# print("wait time = ", timer.wait_time)
# jump(JUMP_VELOCITY)
# print("cayote_jump")
func _on_timer_timeout() -> void:
jump_permission = 0
print("Cayote out")
also trying to debug I made it so that the timer started in ready function, manually set to 10 seconds and print Cayotied, i made 3 attempts to make it output Cayotied.
#1 output was spammed.
#2 & #3 no output was displayed.
[ready function]
timer.start(10)
[physics process function] #1
if timer.timeout:
print ("cayotied")
if timer.time_left == 0: #2
print ("cayotied")
or
func _on_timer_timeout() -> void: #3
print ("cayotied")
is this a bug or is it just me being dumb?
(if I forgot to add something lmk)