WIP: Currently I'm not sure how to do it

This commit is contained in:
2025-01-26 14:39:11 +01:00
parent 7da4a3d6bb
commit adce112be9
7 changed files with 54 additions and 8 deletions

View File

@ -1,8 +1,11 @@
extends Node3D
var owner_placeholder: CharacterBody3D = null
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
print("ready")
owner_placeholder = _get_owner()
pass # Replace with function body.
@ -12,5 +15,12 @@ func _process(delta: float) -> void:
func _on_head_collision_body_part_hit(dam: Variant) -> void:
print("head is hit")
print("head is hit" + str(dam))
owner_placeholder.take_damage(dam)
pass # Replace with function body.
func _get_owner() -> CharacterBody3D:
var owner_placeholder := find_parent("CharacterPlaceholder")
return owner_placeholder

View File

@ -4,10 +4,10 @@ extends Area3D
signal body_part_hit(dam)
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=3 uid="uid://b10lpwfjgxds4"]
[gd_scene load_steps=10 format=3 uid="uid://b10lpwfjgxds4"]
[ext_resource type="Script" path="res://scripts/player/player_input_controller.gd" id="1_q75ai"]
[ext_resource type="Texture2D" uid="uid://oopj5mj1vdp0" path="res://assets/crosshairs/crosshair_default.png" id="2_lsd7c"]
@ -72,6 +72,9 @@ _data = {
"shooting": SubResource("Animation_ah507")
}
[sub_resource type="LabelSettings" id="LabelSettings_toaij"]
font_size = 70
[node name="CharacterPlaceholder" type="CharacterBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.799455, 0)
collision_layer = 9
@ -96,6 +99,7 @@ transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0,
[node name="AimRay" type="RayCast3D" parent="FirstPersonCameraMount/BulletStartingPoint"]
target_position = Vector3(0, 0, 1000)
hit_from_inside = true
collide_with_areas = true
[node name="GunMount" type="Node3D" parent="FirstPersonCameraMount"]
@ -130,5 +134,16 @@ grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("2_lsd7c")
[node name="HealthIndicator" type="Label" parent="FirstPersonCameraMount/HUD"]
layout_mode = 1
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_top = -23.0
offset_right = 40.0
grow_vertical = 0
text = "100"
label_settings = SubResource("LabelSettings_toaij")
[node name="ModelMount" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.790262, 0)