Final touches

This commit is contained in:
2024-06-12 17:51:29 +02:00
parent 9cfd9e0200
commit 965a56c7ad
8 changed files with 120 additions and 77 deletions

8
Mob.gd
View File

@@ -5,12 +5,12 @@ extends CharacterBody3D
signal squashed
func _physics_process(delta):
func _physics_process(delta):
move_and_slide()
func initialize(start_position, player_position):
# Look to the player
look_at_from_position(start_position, player_position, Vector3.UP)
look_at_horizontal(start_position, player_position)
# But rotate a little bit
rotate_y(randf_range(-PI / 4, PI / 4))
# Set random speed
@@ -21,6 +21,10 @@ func initialize(start_position, player_position):
$AnimationPlayer.speed_scale = random_speed / min_speed
func look_at_horizontal(start_position: Vector3, target_position: Vector3):
var target_horizontal_position = Vector3(target_position.x, start_position.y, target_position.z)
look_at_from_position(start_position, target_horizontal_position, Vector3.UP)
func squash():
squashed.emit()
queue_free()