I have a little problem with the tutorial of your first 2d Game

this is the code:

Main.gd

extends Node

@export var mob_scene: PackedScene
var score

func _ready():
new_game()

func _on_player_hit():
pass

func game_over():
$ScoreTimer.stop()
$MobTimer.stop()

func new_game():
score = 0
$Player.start($StartPosition.position)
$StartTimer.start()

func _on_mob_timer_timeout():

var mob = mob_scene.instantiate()


var mob_spawn_location = $MobPath/MobSpawnLocation
mob_spawn_location.progress_ratio = randf()


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)

func _on_score_timer_timeout():
score += 1

func _on_start_timer_timeout():
$MobTimer.start()
$ScoreTimer.start()

i don’t know how resolve the problem

If you need the other code “player” and “mob” tell me and i show you but is just the same of the tutorial (i think)

StartPosition should be under Main not under Player, you’ve put everything under Player instead of under Main, see:
image

1 Like

image
yep, before i feel sleepy i look the docs and change that but my error still there:frowning_face:

ikn what to do