how to create a variable out of an enum?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Wurzelpilz
extends Node2D
   
enum Check {
	right,
	left,
	down,
	up
}

var my_enum : Check

that does not work: the identifier Check is not a valid type (not a script, or class)
(Check) var my_enum

:bust_in_silhouette: Reply From: r.bailey

Think the easy solution here is to just not type the my_enum value. You can still use the enum, just set it to the my_enum wherever. Example below.

enum Check { right, left, down, up }

var my_check_enum

func _ready() :
my_check_enum = Check.right

func somethingelse -> void:
my_check_enum = Check.up