help me with the update function :(

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

so i have a little problem while learning godot course by, so yan can use func update(motion), but i cant, it is said : parent signature is " void update():"
so how can i fix this to continue the course
PlayerScript :
extends KinematicBody2D

const SPEED = 750
const GRAVITY = 2000
const JUMP_SPEED = -1000
const UP = Vector2(0,-1)
var motion = Vector2()

func _physics_process(delta):


func _process(delta):
func update_animation(motion):

func fall(delta):
if is_on_floor():
motion.y = 0
motion.y += GRAVITY * delta
func Run():
if Input.is_action_pressed(“ui_right”) and not Input.is_action_pressed(“ui_left”):
motion.x = SPEED

elif Input.is_action_pressed("ui_left") and not Input.is_action_pressed("ui_right") :
	motion.x = -SPEED
	motion.x = 0
	$AnimatedSprite.flip_h = false

func jump():
if is_on_floor() and Input.is_action_pressed(“ui_up”):
motion.y = JUMP_SPEED

and the func update script :
extends AnimatedSprite

func update(motion):
if motion.x > 0:
flip_h = false
elif motion.x < 0 :
flip_h = true

help me :frowning:

:bust_in_silhouette: Reply From: Bernard Cloutier

Starting in Godot 3.1, when overriding a method, the signature must match the same number of parameters. The issue is that the update method in AnimatedSprite overrides the parent class CanvasItem’s own update method, which takes in no parameter. It’s probably a mistake to override the CanvasItem method. Maybe the course you’re following still uses Godot 3.0?

To fix it, you should simply rename your update function to something else, like update_motion or update_animation.