0 votes

The specific functions are process and _oninput_event.

Thanks a lot in advance.

asked Apr 22, 2018 in Engine by mrsandman (16 points)

1 Answer

0 votes

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).

answered Apr 22, 2018 by HalfTough (109 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.