I need to use this script written in godot 3 to work in godot 4
language is gdscript
extends Path2D
enum ANIMATION_TYPE {
LOOP,
BOUNCE,
}
export(ANIMATION_TYPE) var animation_type
onready var animationPlayer: = $AnimationPlayer
func _ready():
match animation_type:
ANIMATION_TYPE.LOOP: animationPlayer.play("MoveAlongPathLoop")
ANIMATION_TYPE.BOUNCE: animationPlayer.play("MoveAlongPathBounce")
I tried it out and this way should work.
extends Path2D
enum ANIMATION_TYPE {
LOOP,
BOUNCE,
}
@export var animation_type : ANIMATION_TYPE
@onready var animationPlayer: = $AnimationPlayer
func _ready():
match animation_type:
ANIMATION_TYPE.LOOP: animationPlayer.play("MoveAlongPathLoop")
ANIMATION_TYPE.BOUNCE: animationPlayer.play("MoveAlongPathBounce")