clean up file structure
This commit is contained in:
parent
1318fdd9fc
commit
324e7d437b
28 changed files with 102 additions and 125 deletions
25
enemies/police_car/police_car.gd
Normal file
25
enemies/police_car/police_car.gd
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
class_name PoliceCar
|
||||
extends CharacterBody3D
|
||||
|
||||
@export var dot_curve: Curve
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
%NavAgent.target_position = Player.instance.global_position
|
||||
|
||||
var dir := global_position.direction_to(%NavAgent.get_next_path_position())
|
||||
dir.y = 0
|
||||
var dot_power := dot_curve.sample(dir.dot(velocity.normalized()))
|
||||
velocity += dir * 8. * delta * dot_power
|
||||
velocity = velocity.limit_length(8.)
|
||||
move_and_slide()
|
||||
|
||||
rotation.y = Vector2(velocity.x, -velocity.z).angle()
|
||||
|
||||
func hit(_proj: PlayerProjectile):
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_hurtbox_body_entered(body: Node3D) -> void:
|
||||
if body is Player:
|
||||
body.damage(self)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue