Dodge The Creeps only Spawns 1 creep

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


In normal situations 1 creep would be 1 creep too many but in this situation one creep is a problem.

when I run the scene only one creep ever spawns as you can see in the link below:

Anyone happen to know what may cause this?

Steps I took to try to problem shoot:

  1. Since I am doing this in C# could it be the way I am naming my Signals? Since GDScript likes snake case but C# wants it in Pascal notation? I went and renamed all my signals in Pascal notation, did a rebuild, and nothing changed.

  2. Could it be the game loop? Since it fires once maybe something is blocking the MobTimer? Nope looks fine but copied and pasted the code from the example to no success.

  3. Came to this forum for a sanity check.

Copy of main code:

using Godot;
using System;

public class Main : Node
    public PackedScene Mob;

     private int _score;

private Random _random = new Random();

public override void _Ready()

public void GameOver()

public void NewGame()
    _score = 0;

    var player = GetNode<Player>("Player");
    var startPosition = GetNode<Position2D>("StartPosition");


public void OnStartTimerTimeout()

public void OnScoreTimerTimeout()

public void OnMobTimerTimeout()
    // Choose a random location on Path2D.
    var mobSpawnLocation = GetNode<PathFollow2D>("MobPath/MobSpawnLocation");
    mobSpawnLocation.Offset = _random.Next();

    // Create a Mob instance and add it to the scene.
    var mobInstance = (RigidBody2D)Mob.Instance();

    // Set the mob's direction perpendicular to the path direction.
    float direction = mobSpawnLocation.Rotation + Mathf.Pi / 2;

    // Set the mob's position to a random location.
    mobInstance.Position = mobSpawnLocation.Position;

    // Add some randomness to the direction.
    direction += RandRange(-Mathf.Pi / 4, Mathf.Pi / 4);
    mobInstance.Rotation = direction;

    // Choose the velocity.
    mobInstance.LinearVelocity = new Vector2(RandRange(150f, 250f), 0).Rotated(direction);

private float RandRange(float min, float max)
    return (float)_random.NextDouble() * (max - min) + min;
:bust_in_silhouette: Reply From: jgodfrey

Just guessing, but since you’re getting a single mob instance, I wonder if the MobTimer instance’s one_shot property is set to true? That’d cause the timer to fire only once…

Thanks for getting back to me! It looks like my one shot is not set :confused:

Quimbley | 2020-10-28 21:20