I'm making an infinite runner game
I have a player scene with a timer inside it.
I wanted the Timer to emit a signal every 30 seconds (but I change it to 1 for debugging)
every time the timer signal is emitted, I want to increase the player going down speed (velocity.y) by 10 value (but I change it to 100 so I can see the effect easily)
but every time the timer is signal is emitted the speed didn't change at all.
when I put two print(velocity.y) method on physics_process() and on_Increase_Speed_timeout() function
the two method output different value
physics_process() print method output = 100
on_Increase_Speed_timeout() print method output = 200
is there a way for the _on_Increase_Speed_timeout() to change the original variables instead of making a new one?
timer function
func _on_Increase_Speed_timeout(extra_arg_0):
velocity.y += 100
print(velocity.y)
physics process function:
`func _physics_process(delta):
animationPlayer.play("Walkin")
if Input.is_action_just_pressed("ui_left"):
state = "MOVE_LEFT"
if Input.is_action_just_pressed("ui_right"):
state = "MOVE_RIGHT"
velocity.y = 100
print(velocity.y)
move(delta)
global.playerPos = position`
Output:
100
100
100
200
100
100
100