Dodge the Creeps doesn't start mob

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

I am new to programming but I have already completed the tutorial up to the HUD part to perfection as it is in the tutorial, the only drawback is that the mob does not work it does not start it does nothing and that I did everything that the tutorial. I already looked in youtube and also in the forum and I still can’t find what I’m failing, I don’t get an error or anything I run the game I get the normal game I press start and I get the player with the timer both work well but not nowhere do I see the mob I pass what I have done to see if they find my mistake or pass me yours to compare

here is the HUD

extends CanvasLayer

signal start_game

func show_message(text):
$MessageLabel.text = text
$MessageLabel.show()
$MessageTimer.start()

func show_game_over():
show_message(“Game Over”)
yield($MessageTimer, “timeout”)

$MessageLabel.text = "Dodge the\nCreeps!"
$MessageLabel.show()
yield(get_tree().create_timer(1), "timeout")
$StartButton.show()

func update_score(score):
$ScoreLabel.text = str(score)

func _on_StartButton_pressed():
$StartButton.hide()
emit_signal(“start_game”)

func _on_MessageTimer_timeout():
$MessageLabel.hide()

mob

extends RigidBody2D

export var min_speed = 150 # Minimum speed range.
export var max_speed = 250 # Maximum speed range.

func _ready():
var mob_types = $AnimatedSprite.frames.get_animation_names()
$AnimatedSprite.animation = mob_types[randi() % mob_types.size()]

func _on_VisibilityNotifier2D_screen_exited():
queue_free()

player

extends Area2D
signal hit
export var speed = 400 # How fast the player will move (pixels/sec).
var screen_size # Size of the game window.
func _ready():
screen_size = get_viewport_rect().size
hide()
func _process(delta):
var velocity = Vector2() # The player’s movement vector.
if Input.is_action_pressed(“ui_right”):
velocity.x += 1
if Input.is_action_pressed(“ui_left”):
velocity.x -= 1
if Input.is_action_pressed(“ui_down”):
velocity.y += 1
if Input.is_action_pressed(“ui_up”):
velocity.y -= 1
if velocity.length() > 0:
velocity = velocity.normalized() * speed
$AnimatedSprite.play()
else:
$AnimatedSprite.stop()
position += velocity * delta
position.x = clamp(position.x, 0, screen_size.x)
position.y = clamp(position.y, 0, screen_size.y)
if velocity.x != 0:
$AnimatedSprite.animation = “right”
$AnimatedSprite.flip_v = false
$AnimatedSprite.flip_h = velocity.x < 0
elif velocity.y != 0:
$AnimatedSprite.animation = “up”
$AnimatedSprite.flip_v = velocity.y > 0

func _on_Player_body_entered(body):
hide()
emit_signal(“hit”)
$CollisionShape2D.set_deferred(“disabled”, true)

func start(pos):
position = pos
show()
$CollisionShape2D.disabled = false

main

extends Node

export (PackedScene) var Mob
var score

func _ready():
randomize()

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

func new_game ():
score = 0
$Player.start($StartPosition.position)
$ScoreTimer.start()
$HUD.show_message(“Get Ready”)
$HUD.update_score(score)

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

func _on_ScoreTimer_timeout():

score += 1
$HUD.update_score(score)

func _on_MobTimer_timeout():
$MobPath/MobSpawnLocation.offset = randi()
var mob = Mob.instance()
add_child(mob)
var direction = $MobPath/MobSpawnLocation.rotation + PI / 2
mob.position = $MobPath/MobSpawnLocation.position
direction += rand_range(-PI / 4, PI / 4)
mob.rotation = direction
mob.linear_velocity = Vector2(rand_range(mob.MIN_SPEED, mob.MAX_SPEED), 0)
mob.linear_velocity = mob.linear_velocity.rotated(direction)

:bust_in_silhouette: Reply From: njamster

You start the ScoreTimer

func new_game ():
    # ...
    $ScoreTimer.start()
    # ...

instead of the StartTimer:

func new_game ():
    # ...
    $StartTimer.start()
    # ...

Consequentially the MobTimer is never started as well and no mobs will spawn.