small death animation and toolbox
This commit is contained in:
@@ -40,12 +40,6 @@ func close() -> void:
|
||||
func _handle_cancel_input() -> void:
|
||||
close()
|
||||
|
||||
func _unhandled_input(event : InputEvent) -> void:
|
||||
return
|
||||
if event.is_action_pressed("ui_cancel"):
|
||||
_handle_cancel_input()
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
func _on_close_button_pressed() -> void:
|
||||
close()
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@ extends Node
|
||||
@export var pause_menu_packed : PackedScene
|
||||
@export var focused_viewport : Viewport
|
||||
@export var player : CharacterBody3D
|
||||
|
||||
@export_group("Inputs")
|
||||
@export var pause:GUIDEAction
|
||||
|
||||
var menu_already_open = false
|
||||
|
||||
139
maps/level1.tscn
139
maps/level1.tscn
@@ -1,5 +1,142 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://bx3cd2hoaok3k"]
|
||||
[gd_scene load_steps=16 format=3 uid="uid://bx3cd2hoaok3k"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://55wehh6xombr" path="res://maps/main_scene_template.tscn" id="1_w4y6q"]
|
||||
[ext_resource type="Material" uid="uid://31aulub2nqov" path="res://assets/greybox/m_greybox.tres" id="2_p48l4"]
|
||||
[ext_resource type="PackedScene" uid="uid://qup00a7x2sji" path="res://scenes/FixedDashTarget/fixed_dashthrough_target.tscn" id="3_qmty4"]
|
||||
[ext_resource type="PackedScene" uid="uid://dxt0e2ugmttqq" path="res://scenes/enemies/grounded_enemy/grounded_enemy.tscn" id="4_5mjy0"]
|
||||
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://components/movement/RMovement.cs" id="5_0k5xu"]
|
||||
[ext_resource type="PackedScene" uid="uid://cmlud1hwkd6sv" path="res://scenes/enemies/flying_enemy/flying_enemy.tscn" id="6_xuqf0"]
|
||||
[ext_resource type="PackedScene" uid="uid://c305mfrtumcyq" path="res://scenes/spawners/spawner.tscn" id="7_ba7rw"]
|
||||
[ext_resource type="Resource" uid="uid://bqq6uukbdfysr" path="res://scenes/enemies/grounded_enemy/grounded_enemy_movement.tres" id="8_cdhvi"]
|
||||
[ext_resource type="Script" uid="uid://baiapod3csndf" path="res://components/health/RHealth.cs" id="9_55uwi"]
|
||||
[ext_resource type="Resource" uid="uid://otfc2snh8umc" path="res://scenes/enemies/grounded_enemy/grounded_enemy_damage.tres" id="10_xyaoo"]
|
||||
[ext_resource type="Resource" uid="uid://bwqjaom4k7rc3" path="res://scenes/enemies/flying_enemy/flying_enemy_movement.tres" id="11_yug0s"]
|
||||
[ext_resource type="Resource" uid="uid://dg1xbjhyhgnnk" path="res://scenes/enemies/flying_enemy/flying_enemy_health.tres" id="12_qgrw7"]
|
||||
[ext_resource type="Resource" uid="uid://dgo65k2ceqfvy" path="res://scenes/enemies/flying_enemy/flying_enemy_damage.tres" id="13_qulje"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_xixm3"]
|
||||
script = ExtResource("5_0k5xu")
|
||||
GravityModifier = 5.0
|
||||
metadata/_custom_type_script = "uid://dtpxijlnb2c5"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_epn1o"]
|
||||
script = ExtResource("9_55uwi")
|
||||
StartingHealth = 1.0
|
||||
metadata/_custom_type_script = "uid://baiapod3csndf"
|
||||
|
||||
[node name="Main" instance=ExtResource("1_w4y6q")]
|
||||
|
||||
[node name="BackgroundMusicPlayer" parent="." index="0"]
|
||||
autoplay = false
|
||||
|
||||
[node name="Player" parent="." index="5"]
|
||||
transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, 2, 1.5, 9.5)
|
||||
|
||||
[node name="Greybox" type="CSGCombiner3D" parent="." index="7"]
|
||||
use_collision = true
|
||||
collision_layer = 256
|
||||
collision_mask = 65553
|
||||
|
||||
[node name="CSGBox3D" type="CSGBox3D" parent="Greybox" index="0"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.096, -0.5, -46.329)
|
||||
use_collision = true
|
||||
size = Vector3(100, 1, 190.741)
|
||||
material = ExtResource("2_p48l4")
|
||||
|
||||
[node name="CSGBox3D2" type="CSGBox3D" parent="Greybox" index="1"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -21.346, 4.5, 2.7915)
|
||||
use_collision = true
|
||||
size = Vector3(6.5, 11, 5.5)
|
||||
material = ExtResource("2_p48l4")
|
||||
|
||||
[node name="CSGBox3D6" type="CSGBox3D" parent="Greybox" index="2"]
|
||||
transform = Transform3D(0.70710677, 0, -0.70710677, 0, 1, 0, 0.70710677, 0, 0.70710677, -15.846001, 2.75, 2.0415)
|
||||
use_collision = true
|
||||
size = Vector3(6.5, 7.5, 11)
|
||||
material = ExtResource("2_p48l4")
|
||||
|
||||
[node name="CSGBox3D7" type="CSGBox3D" parent="Greybox" index="3"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10.346001, 1, 1.0415001)
|
||||
use_collision = true
|
||||
size = Vector3(6.5, 4, 17)
|
||||
material = ExtResource("2_p48l4")
|
||||
|
||||
[node name="CSGBox3D10" type="CSGBox3D" parent="Greybox" index="4"]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.9659258, 0.25881904, 0, -0.25881904, 0.9659258, 13.653999, 0.9705714, -5.336278)
|
||||
use_collision = true
|
||||
size = Vector3(6.5, 4, 24.5)
|
||||
material = ExtResource("2_p48l4")
|
||||
|
||||
[node name="CSGBox3D8" type="CSGBox3D" parent="Greybox" index="5"]
|
||||
transform = Transform3D(0.81915206, 0, 0.57357645, 0, 1, 0, -0.57357645, 0, 0.81915206, -7.3460007, 0, -3.9585)
|
||||
use_collision = true
|
||||
size = Vector3(6.5, 4, 17)
|
||||
material = ExtResource("2_p48l4")
|
||||
|
||||
[node name="CSGBox3D3" type="CSGBox3D" parent="Greybox" index="6"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 18.154, 4.5, 2.7915)
|
||||
use_collision = true
|
||||
size = Vector3(6.5, 11, 5.5)
|
||||
material = ExtResource("2_p48l4")
|
||||
|
||||
[node name="CSGBox3D9" type="CSGBox3D" parent="Greybox" index="7"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 50.154, 0, -20.4585)
|
||||
use_collision = true
|
||||
size = Vector3(6.5, 2, 116)
|
||||
material = ExtResource("2_p48l4")
|
||||
|
||||
[node name="CSGBox3D4" type="CSGBox3D" parent="Greybox" index="8"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 18.154, 4.5, -14.2085)
|
||||
use_collision = true
|
||||
size = Vector3(6.5, 11, 5.5)
|
||||
material = ExtResource("2_p48l4")
|
||||
|
||||
[node name="CSGBox3D5" type="CSGBox3D" parent="Greybox" index="9"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.8460007, 4.5, 17.7915)
|
||||
use_collision = true
|
||||
size = Vector3(6.5, 11, 5.5)
|
||||
material = ExtResource("2_p48l4")
|
||||
|
||||
[node name="FixedDashthroughTarget" parent="." index="8" instance=ExtResource("3_qmty4")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 3.5, -1.5)
|
||||
|
||||
[node name="Enemy" parent="." index="9" node_paths=PackedStringArray("Target") instance=ExtResource("4_5mjy0")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 13.5, 2.5, -8.336809)
|
||||
Target = NodePath("../Player")
|
||||
RMovement = SubResource("Resource_xixm3")
|
||||
|
||||
[node name="Enemy2" parent="." index="10" node_paths=PackedStringArray("Target") instance=ExtResource("4_5mjy0")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 13, 0, -17.33681)
|
||||
Target = NodePath("../Player")
|
||||
RMovement = SubResource("Resource_xixm3")
|
||||
|
||||
[node name="Enemy3" parent="." index="11" node_paths=PackedStringArray("Target") instance=ExtResource("4_5mjy0")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 14, 4, -3.3368092)
|
||||
Target = NodePath("../Player")
|
||||
RMovement = SubResource("Resource_xixm3")
|
||||
|
||||
[node name="FlyingEnemy" parent="." index="12" node_paths=PackedStringArray("Target") instance=ExtResource("6_xuqf0")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8, 7, -16)
|
||||
Target = NodePath("../Player")
|
||||
RMovement = SubResource("Resource_xixm3")
|
||||
|
||||
[node name="FlyingEnemy2" parent="." index="13" node_paths=PackedStringArray("Target") instance=ExtResource("6_xuqf0")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 10, 7, -16)
|
||||
Target = NodePath("../Player")
|
||||
RMovement = SubResource("Resource_xixm3")
|
||||
|
||||
[node name="GroundedSpawner" parent="." index="14" instance=ExtResource("7_ba7rw")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 12, 2.5, -15)
|
||||
EnemyToSpawn = ExtResource("4_5mjy0")
|
||||
MovementInputs = ExtResource("8_cdhvi")
|
||||
HealthInputs = SubResource("Resource_epn1o")
|
||||
DamageInputs = ExtResource("10_xyaoo")
|
||||
IsActiveOnStart = false
|
||||
|
||||
[node name="FlyingSpawner" parent="." index="15" instance=ExtResource("7_ba7rw")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 18, 11, -14)
|
||||
EnemyToSpawn = ExtResource("6_xuqf0")
|
||||
MovementInputs = ExtResource("11_yug0s")
|
||||
HealthInputs = ExtResource("12_qgrw7")
|
||||
DamageInputs = ExtResource("13_qulje")
|
||||
IsActiveOnStart = false
|
||||
|
||||
@@ -64,7 +64,6 @@ shadow_blur = 2.435
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("17_clkha")]
|
||||
transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, 0, 0, 0)
|
||||
collision_layer = 17
|
||||
TutorialDone = true
|
||||
AccelerationAir = 1.5
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ func add_levels_to_container() -> void:
|
||||
var max_level_reached := GameState.get_max_level_reached()
|
||||
var level_iter := 0
|
||||
for file_path in scene_lister.files:
|
||||
if level_iter > max_level_reached : break
|
||||
# if level_iter > max_level_reached : break
|
||||
level_iter += 1
|
||||
var file_name := file_path.get_file() # e.g., "level_1.tscn"
|
||||
file_name = file_name.trim_suffix(".tscn") # Remove the ".tscn" extension
|
||||
|
||||
@@ -43,7 +43,7 @@ item_0/text = "1 - ExampleLevel"
|
||||
|
||||
[node name="SceneLister" type="Node" parent="."]
|
||||
script = ExtResource("3_stdqw")
|
||||
files = Array[String](["res://menus/scenes/game_scene/levels/level_1.tscn", "res://menus/scenes/game_scene/levels/level_2.tscn", "res://menus/scenes/game_scene/levels/level_3.tscn"])
|
||||
files = Array[String](["res://maps/level1.tscn", "res://maps/city.tscn", "res://maps/GYMs/enemies.tscn", "res://maps/GYMs/metrics.tscn"])
|
||||
directory = "res://menus/scenes/game_scene/levels"
|
||||
|
||||
[connection signal="item_activated" from="Control/LevelButtonsContainer" to="." method="_on_level_buttons_container_item_activated"]
|
||||
|
||||
@@ -44,7 +44,7 @@ func _input(event : InputEvent) -> void:
|
||||
|
||||
func _add_level_select_if_set() -> void:
|
||||
if level_select_packed_scene == null: return
|
||||
if GameState.get_max_level_reached() <= 0 : return
|
||||
# if GameState.get_max_level_reached() <= 0 : return
|
||||
level_select_scene = level_select_packed_scene.instantiate()
|
||||
level_select_scene.hide()
|
||||
%LevelSelectContainer.call_deferred("add_child", level_select_scene)
|
||||
@@ -53,6 +53,7 @@ func _add_level_select_if_set() -> void:
|
||||
%LevelSelectButton.show()
|
||||
|
||||
func _show_continue_if_set() -> void:
|
||||
return
|
||||
if GameState.has_game_state():
|
||||
%ContinueGameButton.show()
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[gd_scene load_steps=19 format=3 uid="uid://vm22i5sv3p3s"]
|
||||
[gd_scene load_steps=20 format=3 uid="uid://vm22i5sv3p3s"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c6k5nnpbypshi" path="res://addons/maaacks_game_template/base/scenes/menus/main_menu/main_menu.tscn" id="1_my8ii"]
|
||||
[ext_resource type="Script" uid="uid://c0ntfmiuw4ttg" path="res://menus/scenes/menus/main_menu/main_menu_with_animations.gd" id="2_nyjay"]
|
||||
[ext_resource type="PackedScene" uid="uid://fybssggvts5q" path="res://menus/scenes/menus/level_select_menu/level_select_menu.tscn" id="3_8i6b8"]
|
||||
[ext_resource type="AudioStream" uid="uid://f8cvr5s041ej" path="res://assets/audio/ambiance/637083__nox_sound__ambiance_nature_night_cricket_calm_loop_stereo.wav" id="3_tvvjd"]
|
||||
[ext_resource type="Resource" uid="uid://c2hpxkcujyc13" path="res://systems/inputs/menu_mode/menu_mode.tres" id="3_ytpwg"]
|
||||
[ext_resource type="Resource" uid="uid://ck43v3q5ype3f" path="res://systems/inputs/menu_mode/back.tres" id="4_8i6b8"]
|
||||
@@ -352,8 +353,8 @@ graph_offset = Vector2(-180.277, 49)
|
||||
|
||||
[node name="MainMenu" instance=ExtResource("1_my8ii")]
|
||||
script = ExtResource("2_nyjay")
|
||||
level_select_packed_scene = null
|
||||
game_scene_path = "uid://dmkw8cmalm5k"
|
||||
level_select_packed_scene = ExtResource("3_8i6b8")
|
||||
game_scene_path = "uid://bx3cd2hoaok3k"
|
||||
menu_context = ExtResource("3_ytpwg")
|
||||
back_action = ExtResource("4_8i6b8")
|
||||
|
||||
@@ -378,14 +379,14 @@ modulate = Color(1, 1, 1, 0)
|
||||
modulate = Color(1, 1, 1, 0)
|
||||
|
||||
[node name="TitleLabel" parent="MenuContainer/TitleMargin/TitleContainer" index="0"]
|
||||
text = "Swoosh"
|
||||
text = "Lightmæres"
|
||||
lock = true
|
||||
|
||||
[node name="SubTitleContainer" parent="MenuContainer/SubTitleMargin" index="0"]
|
||||
modulate = Color(1, 1, 1, 0)
|
||||
|
||||
[node name="SubTitleLabel" parent="MenuContainer/SubTitleMargin/SubTitleContainer" index="0"]
|
||||
text = "A prototype"
|
||||
text = "pre-alpha build"
|
||||
|
||||
[node name="MenuButtonsContainer" parent="MenuContainer/MenuButtonsMargin" index="0"]
|
||||
modulate = Color(1, 1, 1, 0)
|
||||
@@ -398,13 +399,11 @@ text = "Start"
|
||||
|
||||
[node name="ContinueGameButton" type="Button" parent="MenuContainer/MenuButtonsMargin/MenuButtonsContainer/MenuButtonsBoxContainer" index="1"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "Continue"
|
||||
|
||||
[node name="LevelSelectButton" type="Button" parent="MenuContainer/MenuButtonsMargin/MenuButtonsContainer/MenuButtonsBoxContainer" index="2"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "Level Select"
|
||||
|
||||
|
||||
10
menus/scenes/overlaid_menus/toolbox.gd
Normal file
10
menus/scenes/overlaid_menus/toolbox.gd
Normal file
@@ -0,0 +1,10 @@
|
||||
@tool
|
||||
@icon("res://assets/ui/IconGodotNode/control/icon_gear_2.png")
|
||||
class_name Toolbox
|
||||
extends OverlaidMenu
|
||||
|
||||
@export var player: PlayerController
|
||||
|
||||
func _on_kill_player_button_pressed() -> void:
|
||||
get_tree().create_timer(1).timeout.connect(player.Kill)
|
||||
close()
|
||||
1
menus/scenes/overlaid_menus/toolbox.gd.uid
Normal file
1
menus/scenes/overlaid_menus/toolbox.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cu4q0we3xmm1g
|
||||
78
menus/scenes/overlaid_menus/toolbox.tscn
Normal file
78
menus/scenes/overlaid_menus/toolbox.tscn
Normal file
@@ -0,0 +1,78 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://bcn582q8qd4ns"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cu4q0we3xmm1g" path="res://menus/scenes/overlaid_menus/toolbox.gd" id="1_licsr"]
|
||||
[ext_resource type="Script" uid="uid://1nf36h0gms3q" path="res://addons/maaacks_game_template/base/scripts/capture_focus.gd" id="2_6ax4q"]
|
||||
|
||||
[node name="Toolbox" type="Control"]
|
||||
process_mode = 3
|
||||
top_level = true
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_licsr")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 9
|
||||
anchor_bottom = 1.0
|
||||
offset_right = 512.0
|
||||
grow_vertical = 2
|
||||
theme_override_constants/margin_left = 32
|
||||
theme_override_constants/margin_top = 32
|
||||
theme_override_constants/margin_right = 32
|
||||
theme_override_constants/margin_bottom = 32
|
||||
|
||||
[node name="MenuPanelContainer" type="PanelContainer" parent="MarginContainer"]
|
||||
unique_name_in_owner = true
|
||||
process_mode = 3
|
||||
layout_mode = 2
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/MenuPanelContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 16
|
||||
theme_override_constants/margin_top = 16
|
||||
theme_override_constants/margin_right = 16
|
||||
theme_override_constants/margin_bottom = 16
|
||||
|
||||
[node name="BoxContainer" type="BoxContainer" parent="MarginContainer/MenuPanelContainer/MarginContainer"]
|
||||
layout_mode = 2
|
||||
vertical = true
|
||||
|
||||
[node name="TitleMargin" type="MarginContainer" parent="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TitleLabel" type="Label" parent="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer/TitleMargin"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 24
|
||||
text = "Toolbox"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="PlayerSection" type="MarginContainer" parent="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_top = 16
|
||||
theme_override_constants/margin_bottom = 16
|
||||
|
||||
[node name="MenuButtons" type="BoxContainer" parent="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSection"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(128, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 16
|
||||
alignment = 1
|
||||
vertical = true
|
||||
script = ExtResource("2_6ax4q")
|
||||
|
||||
[node name="PlayerSectionLabel" type="Label" parent="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSection/MenuButtons"]
|
||||
layout_mode = 2
|
||||
text = "Player"
|
||||
|
||||
[node name="KillPlayerButton" type="Button" parent="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSection/MenuButtons"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Kill in 1s"
|
||||
|
||||
[connection signal="pressed" from="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSection/MenuButtons/KillPlayerButton" to="." method="_on_kill_player_button_pressed"]
|
||||
@@ -436,9 +436,9 @@ public partial class PlayerController : CharacterBody3D,
|
||||
|
||||
PlayerUi.Initialize(CHealth.CurrentHealth);
|
||||
CDamageable.DamageTaken += (damageable, record) => ReduceHealth(damageable, record);
|
||||
CDamageable.DamageTaken += (damageable, record) => RegisterKnockback(new KnockbackRecord(record));
|
||||
CDamageable.DamageTaken += (_, record) => RegisterKnockback(new KnockbackRecord(record));
|
||||
CHealth.HealthChanged += PlayerUi.OnHealthChanged;
|
||||
CHealth.HealthDepleted += Kill;
|
||||
CHealth.HealthDepleted += (_) => Kill();
|
||||
|
||||
// State management
|
||||
_playerState = StateChart.Of(GetNode("StateChart"));
|
||||
@@ -499,6 +499,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
HeadSystem.HitboxActivated += OnHitboxActivated;
|
||||
HeadSystem.HitboxDeactivated += OnHitboxDeactivated;
|
||||
HeadSystem.StepFoot += OnFootStepped;
|
||||
HeadSystem.DeathAnimationFinished += OnDeathAnimationFinished;
|
||||
|
||||
// Movement stuff
|
||||
// Getting universal setting from GODOT editor to be in sync
|
||||
@@ -2172,7 +2173,12 @@ public partial class PlayerController : CharacterBody3D,
|
||||
return kb;
|
||||
}
|
||||
|
||||
public void Kill(IHealthable source)
|
||||
public void Kill()
|
||||
{
|
||||
HeadSystem.OnStartDeathAnimation();
|
||||
}
|
||||
|
||||
public void OnDeathAnimationFinished()
|
||||
{
|
||||
EmitSignalPlayerDied();
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ warnings/check_invalid_track_paths=false
|
||||
[application]
|
||||
|
||||
config/name="Movement tests"
|
||||
run/main_scene="uid://q7uc1h2jpbd2"
|
||||
run/main_scene="uid://bx3cd2hoaok3k"
|
||||
config/features=PackedStringArray("4.5", "C#", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ public partial class HeadSystem : Node3D
|
||||
public delegate void HitTargetEventHandler();
|
||||
[Signal]
|
||||
public delegate void GotHitEventHandler();
|
||||
[Signal]
|
||||
public delegate void DeathAnimationFinishedEventHandler();
|
||||
|
||||
[Signal]
|
||||
public delegate void StepFootEventHandler();
|
||||
@@ -129,6 +131,15 @@ public partial class HeadSystem : Node3D
|
||||
{
|
||||
_animationTree.Set("parameters/OnHit/request", (int) AnimationNodeOneShot.OneShotRequest.Fire);
|
||||
}
|
||||
public void OnStartDeathAnimation()
|
||||
{
|
||||
_animationTree.Set("parameters/OnDie/request", (int) AnimationNodeOneShot.OneShotRequest.Fire);
|
||||
}
|
||||
|
||||
public void OnDeathAnimationFinished()
|
||||
{
|
||||
EmitSignalDeathAnimationFinished();
|
||||
}
|
||||
|
||||
public void OnHitTarget()
|
||||
{
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
[gd_resource type="AnimationNodeBlendTree" load_steps=11 format=3 uid="uid://c26yvcyyyj811"]
|
||||
[gd_resource type="AnimationNodeBlendTree" load_steps=13 format=3 uid="uid://c26yvcyyyj811"]
|
||||
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://3r5oeg0ho0d4" path="res://systems/head/fp_state_machine.tres" id="1_knaxl"]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_1hkum"]
|
||||
animation = &"die"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_knaxl"]
|
||||
animation = &"idle"
|
||||
|
||||
[sub_resource type="AnimationNodeOneShot" id="AnimationNodeOneShot_ao3u1"]
|
||||
|
||||
[sub_resource type="AnimationNodeOneShot" id="AnimationNodeOneShot_1hkum"]
|
||||
|
||||
[sub_resource type="AnimationNodeOneShot" id="AnimationNodeOneShot_knaxl"]
|
||||
@@ -32,8 +37,8 @@ animation = &"jump_start"
|
||||
animation = &"mantle"
|
||||
|
||||
[resource]
|
||||
graph_offset = Vector2(-223.13931, -84.56735)
|
||||
nodes/output/position = Vector2(1540, 0)
|
||||
graph_offset = Vector2(-290.66962, -123.155754)
|
||||
nodes/output/position = Vector2(1700, -40)
|
||||
nodes/AnimationNodeStateMachine/node = ExtResource("1_knaxl")
|
||||
nodes/AnimationNodeStateMachine/position = Vector2(-560, 180)
|
||||
nodes/Idle/node = SubResource("AnimationNodeAnimation_knaxl")
|
||||
@@ -54,4 +59,8 @@ nodes/OnMantle/node = SubResource("AnimationNodeOneShot_dlkjl")
|
||||
nodes/OnMantle/position = Vector2(900, -60)
|
||||
nodes/mantle/node = SubResource("AnimationNodeAnimation_lwjon")
|
||||
nodes/mantle/position = Vector2(640, 320)
|
||||
node_connections = [&"output", 0, &"OnHit", &"OnHit", 0, &"OnMantle", &"OnHit", 1, &"hit1", &"OnJumpStart", 0, &"Idle", &"OnJumpStart", 1, &"jump_start", &"OnJumpEnd", 0, &"OnJumpStart", &"OnJumpEnd", 1, &"jump_end", &"OnMantle", 0, &"OnJumpEnd", &"OnMantle", 1, &"mantle"]
|
||||
nodes/OnDie/node = SubResource("AnimationNodeOneShot_ao3u1")
|
||||
nodes/OnDie/position = Vector2(1500, -60)
|
||||
nodes/Die/node = SubResource("AnimationNodeAnimation_1hkum")
|
||||
nodes/Die/position = Vector2(1280, 340)
|
||||
node_connections = [&"output", 0, &"OnDie", &"OnHit", 0, &"OnMantle", &"OnHit", 1, &"hit1", &"OnJumpStart", 0, &"Idle", &"OnJumpStart", 1, &"jump_start", &"OnJumpEnd", 0, &"OnJumpStart", &"OnJumpEnd", 1, &"jump_end", &"OnMantle", 0, &"OnJumpEnd", &"OnMantle", 1, &"mantle", &"OnDie", 0, &"OnHit", &"OnDie", 1, &"Die"]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=29 format=3 uid="uid://0ysqmqphq6mq"]
|
||||
[gd_scene load_steps=30 format=3 uid="uid://0ysqmqphq6mq"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dtkdrnsmlwm67" path="res://systems/head/HeadSystem.cs" id="1_8abgy"]
|
||||
[ext_resource type="ArrayMesh" uid="uid://ckr26s4e3fj1m" path="res://assets/swords/resources/fp_sword23.tres" id="2_c5qep"]
|
||||
@@ -133,6 +133,30 @@ tracks/4/keys = {
|
||||
"update": 0,
|
||||
"values": [Vector3(0, 0, 0)]
|
||||
}
|
||||
tracks/5/type = "value"
|
||||
tracks/5/imported = false
|
||||
tracks/5/enabled = true
|
||||
tracks/5/path = NodePath("../../FPRig:position")
|
||||
tracks/5/interp = 1
|
||||
tracks/5/loop_wrap = true
|
||||
tracks/5/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0, 0, 0)]
|
||||
}
|
||||
tracks/6/type = "value"
|
||||
tracks/6/imported = false
|
||||
tracks/6/enabled = true
|
||||
tracks/6/path = NodePath("../../FPRig:rotation")
|
||||
tracks/6/interp = 1
|
||||
tracks/6/loop_wrap = true
|
||||
tracks/6/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0, 0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_r0h40"]
|
||||
resource_name = "hit1"
|
||||
@@ -305,9 +329,76 @@ tracks/0/keys = {
|
||||
"values": [Vector3(0, 0, 0.00011616433), Vector3(-0.5235988, 0, 0), Vector3(0, 0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_sdjj3"]
|
||||
resource_name = "die"
|
||||
length = 1.0000033
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("..:position")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.7),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0, 0, 0), Vector3(4.792308e-05, -0.4125456, 0.56061167)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("..:rotation")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.3, 0.7),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0, 0, 0.00011616433), Vector3(0, 0, 0), Vector3(-0.12217305, -0.090757124, 1.727876)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("../../FPRig:position")
|
||||
tracks/2/interp = 2
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0, 0.33333334, 0.8333333),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0, 0, 0), Vector3(-0.426, 10, 0.028), Vector3(-1.2110655, 0.36514676, 0.080477595)]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("../../FPRig:rotation")
|
||||
tracks/3/interp = 2
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0, 0.33333334, 0.8333333),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0, 0, 0), Vector3(0.39806452, 0.17761895, 1.4115733), Vector3(-0.5466285, -1.1119838, -2.9170606)]
|
||||
}
|
||||
tracks/4/type = "method"
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/path = NodePath("../..")
|
||||
tracks/4/interp = 1
|
||||
tracks/4/loop_wrap = true
|
||||
tracks/4/keys = {
|
||||
"times": PackedFloat32Array(1),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"values": [{
|
||||
"args": [],
|
||||
"method": &"OnDeathAnimationFinished"
|
||||
}]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_0hyrq"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_urko7"),
|
||||
&"die": SubResource("Animation_sdjj3"),
|
||||
&"hit1": SubResource("Animation_r0h40"),
|
||||
&"idle": SubResource("Animation_0hyrq"),
|
||||
&"jump_end": SubResource("Animation_1ay6d"),
|
||||
@@ -322,6 +413,7 @@ DisplacedWeaponSway = 1.0
|
||||
DisplacedWeaponAdjustmentSpeed = 8.0
|
||||
|
||||
[node name="FPRig" type="Node3D" parent="."]
|
||||
transform = Transform3D(0.9999998, 0, 0, 0, 1.0000002, 0, 0, 0, 1.0000002, 0, 0, 0)
|
||||
|
||||
[node name="Sword" type="Node3D" parent="FPRig"]
|
||||
transform = Transform3D(0.42791694, -0.008550272, -0.9037781, 0.19667713, 0.9768738, 0.0838801, 0.88215953, -0.2136461, 0.41970265, 0.53640664, -0.7880347, -1.9288678)
|
||||
@@ -332,7 +424,7 @@ cast_shadow = 0
|
||||
mesh = ExtResource("2_c5qep")
|
||||
|
||||
[node name="CameraSmooth" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, -0.00011616431, 0, 0.00011616433, 0.9999998, 0, 0, 0, 0.9999998, 0, 0, 0)
|
||||
transform = Transform3D(0.99999994, -0.0001161643, 0, 0.00011616432, 0.99999976, 0, 0, 0, 0.9999998, 0, 0, 0)
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="CameraSmooth"]
|
||||
transform = Transform3D(1, -7.508787e-09, -1.4551914e-08, 7.508788e-09, 0.99999994, -1.5046679e-08, 1.4551915e-08, 1.5046679e-08, 0.99999994, -0.04610423, -0.02960227, -0.053528003)
|
||||
@@ -382,6 +474,9 @@ parameters/OnJumpEnd/request = 0
|
||||
parameters/OnMantle/active = false
|
||||
parameters/OnMantle/internal_active = false
|
||||
parameters/OnMantle/request = 0
|
||||
parameters/OnDie/active = false
|
||||
parameters/OnDie/internal_active = false
|
||||
parameters/OnDie/request = 0
|
||||
|
||||
[connection signal="GotHit" from="." to="CameraSmooth/Camera3D/OnGetHitShaker" method="play_shake"]
|
||||
[connection signal="HitTarget" from="." to="CameraSmooth/Camera3D/OnHitShaker" method="play_shake"]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_resource type="Resource" script_class="GUIDEMappingContext" load_steps=161 format=3 uid="uid://bl5crtu1gkrtr"]
|
||||
[gd_resource type="Resource" script_class="GUIDEMappingContext" load_steps=163 format=3 uid="uid://bl5crtu1gkrtr"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cpplm41b5bt6m" path="res://addons/guide/guide_action_mapping.gd" id="1_qmhk6"]
|
||||
[ext_resource type="Resource" uid="uid://htqvokm8mufq" path="res://systems/inputs/base_mode/move.tres" id="2_g6bbx"]
|
||||
@@ -36,6 +36,7 @@
|
||||
[ext_resource type="Resource" uid="uid://dxy0071ic1wdj" path="res://systems/inputs/base_mode/slam.tres" id="32_s8kjn"]
|
||||
[ext_resource type="Resource" uid="uid://s1l0n1iitc6m" path="res://systems/inputs/base_mode/move_back.tres" id="33_fykw6"]
|
||||
[ext_resource type="Resource" uid="uid://brswsknpgwal2" path="res://systems/inputs/base_mode/move_front.tres" id="34_rvpjj"]
|
||||
[ext_resource type="Resource" uid="uid://ca68r7n3bwba3" path="res://systems/inputs/base_mode/toolbox.tres" id="34_s8kjn"]
|
||||
[ext_resource type="Resource" uid="uid://f3vs6l4m623s" path="res://systems/inputs/base_mode/move_left.tres" id="35_s8kjn"]
|
||||
[ext_resource type="Resource" uid="uid://t612lts1wi1s" path="res://systems/inputs/base_mode/move_right.tres" id="36_vibkn"]
|
||||
|
||||
@@ -479,23 +480,28 @@ script = ExtResource("3_yp12v")
|
||||
input = SubResource("Resource_jjamb")
|
||||
triggers = Array[ExtResource("8_2tfaw")]([SubResource("Resource_4kb6s")])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_weyro"]
|
||||
script = ExtResource("1_qmhk6")
|
||||
action = ExtResource("29_q86qg")
|
||||
input_mappings = Array[ExtResource("3_yp12v")]([SubResource("Resource_ai85f"), SubResource("Resource_1ycft")])
|
||||
metadata/_guide_input_mappings_collapsed = false
|
||||
|
||||
[sub_resource type="Resource" id="Resource_8e1uk"]
|
||||
script = ExtResource("19_qkgmj")
|
||||
button = 4
|
||||
|
||||
[sub_resource type="Resource" id="Resource_ilhhf"]
|
||||
[sub_resource type="Resource" id="Resource_k8i2y"]
|
||||
script = ExtResource("15_fykw6")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_k8i2y"]
|
||||
[sub_resource type="Resource" id="Resource_ilhhf"]
|
||||
script = ExtResource("3_yp12v")
|
||||
input = SubResource("Resource_8e1uk")
|
||||
triggers = Array[ExtResource("8_2tfaw")]([SubResource("Resource_ilhhf")])
|
||||
triggers = Array[ExtResource("8_2tfaw")]([SubResource("Resource_k8i2y")])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_weyro"]
|
||||
[sub_resource type="Resource" id="Resource_o5fur"]
|
||||
script = ExtResource("1_qmhk6")
|
||||
action = ExtResource("29_q86qg")
|
||||
input_mappings = Array[ExtResource("3_yp12v")]([SubResource("Resource_ai85f"), SubResource("Resource_1ycft"), SubResource("Resource_k8i2y")])
|
||||
metadata/_guide_input_mappings_collapsed = false
|
||||
action = ExtResource("34_s8kjn")
|
||||
input_mappings = Array[ExtResource("3_yp12v")]([SubResource("Resource_ilhhf")])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_kcylj"]
|
||||
script = ExtResource("30_cvxqo")
|
||||
@@ -551,5 +557,5 @@ input_mappings = Array[ExtResource("3_yp12v")]([SubResource("Resource_7io5e")])
|
||||
|
||||
[resource]
|
||||
script = ExtResource("23_llfhp")
|
||||
mappings = Array[ExtResource("1_qmhk6")]([SubResource("Resource_88x08"), SubResource("Resource_tgr2g"), SubResource("Resource_iarn8"), SubResource("Resource_cvxqo"), SubResource("Resource_tb8ii"), SubResource("Resource_iihs4"), SubResource("Resource_vibkn"), SubResource("Resource_2hs2y"), SubResource("Resource_d2r0d"), SubResource("Resource_xt1x5"), SubResource("Resource_ew1hw"), SubResource("Resource_3frwi"), SubResource("Resource_0qat1"), SubResource("Resource_vtk18"), SubResource("Resource_weyro"), SubResource("Resource_fjku4"), SubResource("Resource_odnhd"), SubResource("Resource_0eff7"), SubResource("Resource_gt77e")])
|
||||
mappings = Array[ExtResource("1_qmhk6")]([SubResource("Resource_88x08"), SubResource("Resource_tgr2g"), SubResource("Resource_iarn8"), SubResource("Resource_cvxqo"), SubResource("Resource_tb8ii"), SubResource("Resource_iihs4"), SubResource("Resource_vibkn"), SubResource("Resource_2hs2y"), SubResource("Resource_d2r0d"), SubResource("Resource_xt1x5"), SubResource("Resource_ew1hw"), SubResource("Resource_3frwi"), SubResource("Resource_0qat1"), SubResource("Resource_vtk18"), SubResource("Resource_weyro"), SubResource("Resource_o5fur"), SubResource("Resource_fjku4"), SubResource("Resource_odnhd"), SubResource("Resource_0eff7"), SubResource("Resource_gt77e")])
|
||||
metadata/_custom_type_script = "uid://dsa1dnifd6w32"
|
||||
|
||||
7
systems/inputs/base_mode/toolbox.tres
Normal file
7
systems/inputs/base_mode/toolbox.tres
Normal file
@@ -0,0 +1,7 @@
|
||||
[gd_resource type="Resource" script_class="GUIDEAction" load_steps=2 format=3 uid="uid://ca68r7n3bwba3"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cluhc11vixkf1" path="res://addons/guide/guide_action.gd" id="1_pmr0d"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_pmr0d")
|
||||
metadata/_custom_type_script = "uid://cluhc11vixkf1"
|
||||
@@ -1,28 +1,42 @@
|
||||
@icon("res://assets/ui/IconGodotNode/white/icon_gear_2.png")
|
||||
extends Node
|
||||
|
||||
@export_category("Scenes")
|
||||
@export_group("General")
|
||||
@export var main_menu_path : String = "res://menus/scenes/menus/main_menu/main_menu_with_animations.tscn"
|
||||
|
||||
@export_group("Levels")
|
||||
|
||||
@export_category("Menus")
|
||||
@export_group("Overlaid")
|
||||
@export var lost_menu : PackedScene = preload("uid://ciyq8eiv1mtie")
|
||||
@export var lost_menu_scene : PackedScene = preload("uid://ciyq8eiv1mtie")
|
||||
@export var toolbox_scene : PackedScene = preload("uid://bcn582q8qd4ns")
|
||||
|
||||
@export_category("Others")
|
||||
@export var focused_viewport : Viewport
|
||||
@export var toolbox_action:GUIDEAction = preload("uid://ca68r7n3bwba3")
|
||||
|
||||
# Debug
|
||||
@onready var debug_layer: CanvasLayer = $"../DebugLayer"
|
||||
@onready var player: PlayerController = $"../Player"
|
||||
|
||||
func on_player_died() -> void:
|
||||
func _ready() -> void:
|
||||
toolbox_action.triggered.connect(open_toolbox)
|
||||
|
||||
func open_overlaid_menu(menu: PackedScene) -> Node:
|
||||
if not focused_viewport:
|
||||
focused_viewport = get_viewport()
|
||||
var _initial_focus_control = focused_viewport.gui_get_focus_owner()
|
||||
var current_menu: LevelLostMenu = lost_menu.instantiate()
|
||||
return menu.instantiate()
|
||||
|
||||
get_tree().current_scene.call_deferred("add_child", current_menu)
|
||||
current_menu.restart_pressed.connect(restart_current_level)
|
||||
current_menu.main_menu_pressed.connect(back_to_main_menu)
|
||||
func open_toolbox() -> void:
|
||||
var toolbox: Toolbox = open_overlaid_menu(toolbox_scene)
|
||||
toolbox.player = player
|
||||
debug_layer.call_deferred("add_child", toolbox)
|
||||
|
||||
func on_player_died() -> void:
|
||||
var lost_menu: LevelLostMenu = open_overlaid_menu(lost_menu_scene)
|
||||
get_tree().current_scene.call_deferred("add_child", lost_menu)
|
||||
lost_menu.restart_pressed.connect(restart_current_level)
|
||||
lost_menu.main_menu_pressed.connect(back_to_main_menu)
|
||||
|
||||
func back_to_main_menu():
|
||||
SceneLoader.load_scene(main_menu_path)
|
||||
|
||||
Reference in New Issue
Block a user