WIP: Currently I'm not sure how to do it
This commit is contained in:
@ -130,6 +130,12 @@ func _rotate_camera(sens_mod: float = 1.0) -> void:
|
||||
rotation.y -= look_dir.x * camera_sens * sens_mod
|
||||
first_view_camera_mount.rotation.x = clamp(first_view_camera_mount.rotation.x - look_dir.y * camera_sens * sens_mod, -1.5, 1.5)
|
||||
|
||||
@onready var health_indicator = $FirstPersonCameraMount/HUD/HealthIndicator
|
||||
func _process(delta: float) -> void:
|
||||
health_indicator.text = str(health)
|
||||
if health == 0:
|
||||
queue_free()
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
# Add the gravity.
|
||||
if not is_on_floor():
|
||||
@ -169,6 +175,8 @@ func _shoot():
|
||||
var collider := aim_ray.get_collider()
|
||||
if collider != null and collider.is_in_group("target"):
|
||||
aim_ray.get_collider().take_damage()
|
||||
if collider != null and collider.is_in_group("body"):
|
||||
collider.hit()
|
||||
var root := get_tree().get_root()
|
||||
gun_with_hands.shoot()
|
||||
|
||||
@ -198,3 +206,6 @@ func _hit_scan_collision(collision_point):
|
||||
func _hit_scan_damage(Collider):
|
||||
#if Collider.is_in_group("target") and Collider.has_method("take_damage"):
|
||||
print("damaged")
|
||||
|
||||
func take_damage(dam: int):
|
||||
health =- dam
|
||||
|
Reference in New Issue
Block a user