Nonexistent function 'start' in base 'Area2D (player.gd)'

Godot-4

I’m not sure why this is happening as I’m very new to godot.
Here’s the code:

extends Node
@export var mob_scene: PackedScene

func _ready():
$Area2D.start($Marker2D.position)
$Timer2.start()

func _process(delta):
pass

func _on_timer_2_timeout():
$Timer.start()

func _on_timer_timeout():
var mob = mob_scene.instantiate()
var mob_spawn_location = $MobPath/MobSpawnLocation
var direction = mob_spawn_location.rotation + PI / 2
mob.position = mob_spawn_location.position
direction += randf_range(-PI / 4, PI / 4)
mob.rotation = direction
var velocity = Vector2(randf_range(150.0, 250.0), 0.0)
mob.linear_velocity = velocity.rotated(direction)
add_child(mob)

Neither the class Area2D nor any class it inherits from, define a function called “start”.
See: Area2D — Godot Engine (latest) documentation in English

Can you elaborate, what you want to achieve with that call?

1 Like

I’m not sure as I was following a tutorial and just changed some things.

I think it’s meant to spawn the player at the markers position because area2d is the player and marker2d.position is obviously the markers position

To achieve that, you can position the Area2D by:

$Area2D.position = $Marker2D.position

I fixed it just before you replied but now I’m having another issue I’ll just create another post