Godot Version
4.3 (Newest)
Question
I wanted to make variations for fruits using enum. But doing the check with “if” (meaning this: if fruit_skin_type.APPLE:
sprite.play(“IdleApple”))
There seem to be no errors, but there is no check (I wrote “print(helo)” to check if it works).
Can anyone please help? Thanks in advance!
Here’s the code:
enum fruit_skin_type {APPLE, BANANAS, CHERRIES, KIWWWI, MELON, ORANGE, PINEAPPLE, STRAWBERRY}
@export var fruit_skin : fruit_skin_type
@onready var sprite: AnimatedSprite2D = $Sprite
func _process(delta: float) -> void:
if fruit_skin_type.APPLE:
sprite.play("IdleApple")
if fruit_skin_type.BANANAS:
sprite.play("IdleBananas")
Or screenshot: