diff --git a/scenes/chaser.tscn b/scenes/chaser.tscn index 2497eca..e4c420d 100644 --- a/scenes/chaser.tscn +++ b/scenes/chaser.tscn @@ -8,7 +8,7 @@ [ext_resource type="Script" path="res://scripts/states/run.gd" id="6_fllo7"] [ext_resource type="Script" path="res://scripts/states/fall.gd" id="7_0e04j"] [ext_resource type="Script" path="res://scripts/states/dead.gd" id="9_8je4a"] -[ext_resource type="Script" path="res://scripts/states/lunge.gd" id="9_nqccg"] +[ext_resource type="Script" path="res://scripts/states/attack.gd" id="9_nqccg"] [sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_ukf45"] properties/0/path = NodePath(".:player_id") @@ -20,10 +20,10 @@ properties/1/replication_mode = 1 properties/2/path = NodePath(".:server_rotation") properties/2/spawn = true properties/2/replication_mode = 1 -properties/3/path = NodePath("RotationBase/Attack:visible") +properties/3/path = NodePath(".:dead") properties/3/spawn = true properties/3/replication_mode = 1 -properties/4/path = NodePath(".:dead") +properties/4/path = NodePath("RotationBase/AttackHitbox:visible") properties/4/spawn = true properties/4/replication_mode = 1 @@ -111,27 +111,27 @@ mesh = SubResource("SphereMesh_tudvv") transform = Transform3D(0.1, 0, 0, 0, 0.1, 0, 0, 0, 0.1, -0.1, 0.6, -0.25) mesh = SubResource("SphereMesh_1gltg") -[node name="Attack" type="Area3D" parent="RotationBase"] +[node name="AttackHitbox" type="Area3D" parent="RotationBase"] unique_name_in_owner = true transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -0.75) visible = false monitorable = false -[node name="CollisionShape3D" type="CollisionShape3D" parent="RotationBase/Attack"] +[node name="AttackCollider" type="CollisionShape3D" parent="RotationBase/AttackHitbox"] shape = SubResource("BoxShape3D_rsamr") -[node name="MeshInstance3D" type="MeshInstance3D" parent="RotationBase/Attack"] +[node name="AttackVisualBox" type="MeshInstance3D" parent="RotationBase/AttackHitbox"] transparency = 0.8 mesh = SubResource("BoxMesh_phaav") surface_material_override/0 = SubResource("StandardMaterial3D_ssauw") -[node name="AttackTimer" type="Timer" parent="RotationBase/Attack"] +[node name="AttackTimer" type="Timer" parent="RotationBase/AttackHitbox"] unique_name_in_owner = true process_callback = 0 wait_time = 0.35 one_shot = true -[node name="AttackCooldown" type="Timer" parent="RotationBase/Attack"] +[node name="AttackCooldown" type="Timer" parent="RotationBase/AttackHitbox"] unique_name_in_owner = true process_callback = 0 wait_time = 2.0 @@ -170,10 +170,10 @@ script = ExtResource("7_0e04j") unique_name_in_owner = true script = ExtResource("9_8je4a") -[node name="Lunge" type="Node" parent="StateMachine"] +[node name="Attack" type="Node" parent="StateMachine"] unique_name_in_owner = true script = ExtResource("9_nqccg") [connection signal="delta_synchronized" from="Sync" to="." method="_on_sync_delta_synchronized"] -[connection signal="body_entered" from="RotationBase/Attack" to="StateMachine/Lunge" method="_on_attack_body_entered"] -[connection signal="body_exited" from="RotationBase/Attack" to="StateMachine/Lunge" method="_on_attack_body_exited"] +[connection signal="body_entered" from="RotationBase/AttackHitbox" to="StateMachine/Attack" method="_on_attack_body_entered"] +[connection signal="body_exited" from="RotationBase/AttackHitbox" to="StateMachine/Attack" method="_on_attack_body_exited"] diff --git a/scenes/in_game.tscn b/scenes/in_game.tscn index 6fca3fd..8b8d83d 100644 --- a/scenes/in_game.tscn +++ b/scenes/in_game.tscn @@ -1,15 +1,14 @@ -[gd_scene load_steps=7 format=3 uid="uid://d22gcvp7p2sfr"] +[gd_scene load_steps=10 format=3 uid="uid://d22gcvp7p2sfr"] [ext_resource type="Script" path="res://scripts/in_game.gd" id="1_0lma2"] [ext_resource type="PlaneMesh" uid="uid://dwpvym2kc4gd8" path="res://meshes/ground.tres" id="1_7j0qh"] [ext_resource type="Material" uid="uid://chp3rogcgumau" path="res://materials/ground.tres" id="2_f8uto"] -[ext_resource type="PackedScene" uid="uid://cw0ho53ruh87m" path="res://scenes/house.tscn" id="4_38bom"] [sub_resource type="Environment" id="Environment_2c67a"] background_mode = 1 ambient_light_source = 2 ambient_light_color = Color(1, 1, 1, 1) -ambient_light_energy = 0.01 +ambient_light_energy = 0.15 tonemap_mode = 3 sdfgi_read_sky_light = false glow_enabled = true @@ -21,12 +20,23 @@ volumetric_fog_emission_energy = 0.25 [sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_1l61b"] +[sub_resource type="BoxMesh" id="BoxMesh_kcty4"] + +[sub_resource type="BoxShape3D" id="BoxShape3D_6koow"] + +[sub_resource type="BoxShape3D" id="BoxShape3D_y3ciy"] + +[sub_resource type="BoxMesh" id="BoxMesh_2wvq0"] + [node name="InGame" type="Node3D"] script = ExtResource("1_0lma2") [node name="WorldEnvironment" type="WorldEnvironment" parent="."] environment = SubResource("Environment_2c67a") +[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 0.258819, 0.965926, 0, -0.965926, 0.258819, 0, 10.0494, 0) + [node name="ChaserSpawner" type="MultiplayerSpawner" parent="."] _spawnable_scenes = PackedStringArray("res://scenes/chaser.tscn") spawn_path = NodePath("../Chasers") @@ -44,8 +54,6 @@ shape = SubResource("WorldBoundaryShape3D_1l61b") mesh = ExtResource("1_7j0qh") surface_material_override/0 = ExtResource("2_f8uto") -[node name="House" parent="." instance=ExtResource("4_38bom")] - [node name="Chasers" type="Node3D" parent="."] unique_name_in_owner = true @@ -73,4 +81,21 @@ unique_name_in_owner = true wait_time = 0.5 autostart = true +[node name="StaticBody3D" type="StaticBody3D" parent="."] +transform = Transform3D(0.96321, 0, 0.268752, 0, 1, 0, -0.268752, 0, 0.96321, 3, 0.5, 0) + +[node name="MeshInstance3D" type="MeshInstance3D" parent="StaticBody3D"] +mesh = SubResource("BoxMesh_kcty4") + +[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D"] +shape = SubResource("BoxShape3D_6koow") + +[node name="MainObjective" type="StaticBody3D" parent="."] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="MainObjective"] +shape = SubResource("BoxShape3D_y3ciy") + +[node name="MeshInstance3D" type="MeshInstance3D" parent="MainObjective"] +mesh = SubResource("BoxMesh_2wvq0") + [connection signal="timeout" from="PingTimer" to="." method="_on_ping_timer_timeout"] diff --git a/scripts/states/lunge.gd b/scripts/states/attack.gd similarity index 91% rename from scripts/states/lunge.gd rename to scripts/states/attack.gd index d1180ff..8c24bc7 100644 --- a/scripts/states/lunge.gd +++ b/scripts/states/attack.gd @@ -5,14 +5,14 @@ var players_in_area = {} func enter() -> void: super() - if has_node("%Attack"): %Attack.visible = true + if has_node("%AttackHitbox"): %AttackHitbox.visible = true if has_node("%AttackTimer"): %AttackTimer.start() if has_node("%AttackCooldown"): %AttackCooldown.start() hit = false func exit() -> void: super() - if has_node("%Attack"): %Attack.visible = false + if has_node("%AttackHitbox"): %AttackHitbox.visible = false func process_physics(delta: float) -> State: if not Main.is_server_or_predicting(subject.player_id, subject.client_prediction): return diff --git a/scripts/states/idle.gd b/scripts/states/idle.gd index fe9ec9d..447ee82 100644 --- a/scripts/states/idle.gd +++ b/scripts/states/idle.gd @@ -8,7 +8,7 @@ func process_physics(delta: float) -> State: if not subject.is_on_floor(): return %Fall if has_node("%Dead") and subject.dead: return %Dead - if has_node("%Lunge") and %Input.primary_interact and (not has_node("%AttackCooldown") or %AttackCooldown.time_left == 0): return %Lunge + if has_node("%Attack") and %Input.primary_interact and (not has_node("%AttackCooldown") or %AttackCooldown.time_left == 0): return %Attack if input_direction.length() < 0.05: return if has_node("%Walk") and %Input.walk: return %Walk return %Run diff --git a/scripts/states/run.gd b/scripts/states/run.gd index 0330062..7e487f4 100644 --- a/scripts/states/run.gd +++ b/scripts/states/run.gd @@ -8,7 +8,7 @@ func process_physics(delta: float) -> State: if not subject.is_on_floor(): return %Fall if has_node("%Dead") and subject.dead: return %Dead - if has_node("%Lunge") and %Input.primary_interact and (not has_node("%AttackCooldown") or %AttackCooldown.time_left == 0): return %Lunge + if has_node("%Attack") and %Input.primary_interact and (not has_node("%AttackCooldown") or %AttackCooldown.time_left == 0): return %Attack if input_direction.length() < 0.05: return %Idle if has_node("%Walk") and %Input.walk: return %Walk return diff --git a/scripts/states/walk.gd b/scripts/states/walk.gd index 09d4704..9d46b34 100644 --- a/scripts/states/walk.gd +++ b/scripts/states/walk.gd @@ -8,7 +8,7 @@ func process_physics(delta: float) -> State: if not subject.is_on_floor(): return %Fall if has_node("%Dead") and subject.dead: return %Dead - if has_node("%Lunge") and %Input.primary_interact and (not has_node("%AttackCooldown") or %AttackCooldown.time_left == 0): return %Lunge + if has_node("%Attack") and %Input.primary_interact and (not has_node("%AttackCooldown") or %AttackCooldown.time_left == 0): return %Attack if input_direction.length() < 0.05: return %Idle if not %Input.walk: return %Run return