Nonexistent function 'start' in base 'Area2D ('


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():

func _process(delta):

func _on_timer_2_timeout():

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)

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