Move position setting code to be before direction in Dodge the Creeps (#1151)

This commit is contained in:
Mohamed Koubaa
2025-01-10 12:52:54 -06:00
committed by GitHub
parent d3c71ddb20
commit be77353917

View File

@@ -29,12 +29,12 @@ func _on_MobTimer_timeout():
var mob_spawn_location = get_node(^"MobPath/MobSpawnLocation")
mob_spawn_location.progress = randi()
# Set the mob's direction perpendicular to the path direction.
var direction = mob_spawn_location.rotation + PI / 2
# Set the mob's position to a random location.
mob.position = mob_spawn_location.position
# Set the mob's direction perpendicular to the path direction.
var direction = mob_spawn_location.rotation + PI / 2
# Add some randomness to the direction.
direction += randf_range(-PI / 4, PI / 4)
mob.rotation = direction