Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | mrsandman |
The specific functions are _process and _on_input_event.
Thanks a lot in advance.
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | mrsandman |
The specific functions are _process and _on_input_event.
Thanks a lot in advance.
Reply From: | HalfTough |
You can just create variable inside your KinematicBody2D. It will then be available to all functions within your KinematicBody2D.
extends KinematicBody2D
var myVar
func _on_input_event():
myVar = "was input"
func _process():
if myVar:
print("myVar changed")
If you want variable that will be shared only between those two functions – I don’t think that’s possible. At last not if one of the functions isn’t calling another (and in this case you don’t want to do that).