mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-04 15:00:09 +01:00
Move position setting code to be before direction in Dodge the Creeps (#1151)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user