Godot Version
Godot_v4.7.2
Hey everyone
,
I’m working through the official Dodge the Creeps tutorial and running
into a weird issue with mob spawning.
Most mobs spawn correctly at the screen edges, but some of them
teleport — they appear in the wrong place or suddenly jump instead of
spawning at the edge
.
GIF of the issue:

What I expected:
All mobs should spawn at the screen edges and move inward.
What actually happens:
Some mobs teleport or appear from somewhere unexpected.
Code (main.gd, mob spawning):
func _on_mob_timer_timeout() -> void:
var mob: RigidBody2D = mob_scene.instantiate()
var mob_spawn_location = $Path2D/MobSpawnLocation
mob_spawn_location.progress_ratio = randf()
mob.position = mob_spawn_location.position
var direction = mob_spawn_location.rotation + PI / 2
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)