Hello everyone!
I'm quite new to Godot and GDScript in particular. Have worked with UE4 and Blueprints a lot, so some of my analogues would use the terminology from BPs.
I want to make camera shake by changine the v_offset parameter (just for testing purposes). Basically I need to flip-flop it's values every time the timer ends. But what I could get is only one value: the timer shoots every two seconds, but I can't figure out how to return the value after that.
onready var shakeTimer = get_node("Timer")
onready var camera = get_node("Head/Camera")
onready var headBob : bool = true
func _shakeCamera():
if headBob = true :
print ("true")
camera.v_offset -= 0.5
func _on_Timer_timeout():
headBob = false
if headBob == false :
print ("false")
camera.v_offset += 0.5
headBob = true
_shakeCamera()
The result is that the engine executes both values at the same time (timer is set for 2 seconds) : true and false. And in theory I need it to work consequently: true > 2 seconds > false. I know that it may sound and look weird. Probably, I can't get some very obvious and basic programming idea.
I'd be glad if you help.