Invalid call. Nonexistent function 'play' in base 'GDScriptNativeClass'.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ram123

extends RigidBody2D

export var FLAP_FORCE = -200

onready var animator = AnimationPlayer

var started = false

func _physics_process(_delta):
if Input.is_action_just_pressed(“flap”):
if !started:
start()
flap()

func start():
if started: return
started = true
gravity_scale = 5.0
animator.play(“flap”)

func flap():
linear_velocity = FLAP_FORCE

:bust_in_silhouette: Reply From: exuin

“AnimationPlayer” is the actual class. You probably want a NodePath, which starts with $.