Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | rbcodder |
if Input.is_action_just_pressed("g") and out == false:
$Head/neck/Camera/mp7base/mag.play("mag",0.1)
out = true
print("out")
elif Input.is_action_just_pressed("g") and out == true:
$Head/neck/Camera/mp7base/mag.play_backwards("mag",0.1)
out = false
print("in")
its an fps game, i take the mag out by pressing g, if its out the variable is true. the animationplayer just plays the animation of taking it out, if i press it again, it plays the same thing again, but i want it to play it backwards. the out variable prints out true every time i press it.
If “in” is never printed then the variable ‘out’ must be changing from true back to false at some point in code not shown.
LeslieS | 2022-12-27 18:32
No it isnt, its only this code that works on the mag
rbcodder | 2022-12-27 19:01
Is the out
variable’s value being set somewhere outside of the posted code?
jgodfrey | 2022-12-27 19:05
Oh yes its var out = false just this
rbcodder | 2022-12-27 19:08
If you’re setting the value to false
somewhere above the posted code (in the same function), that’s likely the problem…
jgodfrey | 2022-12-27 19:22
AAAAAAAGH HELL… IM AN IDIOT, AND IM SORRY FOR DISTURBING YALL WITH THIS
rbcodder | 2022-12-27 20:59