feat: removed crouch and added a UI for available jumps
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=36 format=3 uid="uid://bei4nhkf8lwdo"]
|
[gd_scene load_steps=38 format=3 uid="uid://bei4nhkf8lwdo"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://bbbrf5ckydfna" path="res://player_controller/Scripts/PlayerController.cs" id="1_poq2x"]
|
[ext_resource type="Script" uid="uid://bbbrf5ckydfna" path="res://player_controller/Scripts/PlayerController.cs" id="1_poq2x"]
|
||||||
[ext_resource type="Resource" uid="uid://bl5crtu1gkrtr" path="res://systems/inputs/base_mode/base_mode.tres" id="3_cresl"]
|
[ext_resource type="Resource" uid="uid://bl5crtu1gkrtr" path="res://systems/inputs/base_mode/base_mode.tres" id="3_cresl"]
|
||||||
@ -34,6 +34,8 @@
|
|||||||
[ext_resource type="Script" uid="uid://tjiji63wlom5" path="res://systems/wall_hug/WallHugSystem.cs" id="27_n7qhm"]
|
[ext_resource type="Script" uid="uid://tjiji63wlom5" path="res://systems/wall_hug/WallHugSystem.cs" id="27_n7qhm"]
|
||||||
[ext_resource type="Script" uid="uid://cf1nsco3w0mf6" path="res://addons/godot_state_charts/transition.gd" id="28_n7qhm"]
|
[ext_resource type="Script" uid="uid://cf1nsco3w0mf6" path="res://addons/godot_state_charts/transition.gd" id="28_n7qhm"]
|
||||||
[ext_resource type="PackedScene" uid="uid://ckm3d6k08a72u" path="res://systems/weapon/weapon.tscn" id="29_wv70j"]
|
[ext_resource type="PackedScene" uid="uid://ckm3d6k08a72u" path="res://systems/weapon/weapon.tscn" id="29_wv70j"]
|
||||||
|
[ext_resource type="Script" uid="uid://bhuwv2nlcrunt" path="res://player_controller/PlayerUi.cs" id="30_2ghaa"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bnwj7ltdfximr" path="res://icon.svg" id="30_h23go"]
|
||||||
|
|
||||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_xc2g5"]
|
[sub_resource type="CapsuleMesh" id="CapsuleMesh_xc2g5"]
|
||||||
height = 1.7
|
height = 1.7
|
||||||
@ -42,7 +44,7 @@ height = 1.7
|
|||||||
script = ExtResource("1_poq2x")
|
script = ExtResource("1_poq2x")
|
||||||
TimeScaleAimInAir = 0.15
|
TimeScaleAimInAir = 0.15
|
||||||
MaxJumpBoostAfterDashing = 0.7
|
MaxJumpBoostAfterDashing = 0.7
|
||||||
MaxNumberOfDashActions = 3
|
MaxNumberOfDashActions = 2
|
||||||
|
|
||||||
[node name="InputController" type="Node3D" parent="."]
|
[node name="InputController" type="Node3D" parent="."]
|
||||||
script = ExtResource("16_v31n3")
|
script = ExtResource("16_v31n3")
|
||||||
@ -181,12 +183,43 @@ wait_time = 0.3
|
|||||||
one_shot = true
|
one_shot = true
|
||||||
|
|
||||||
[node name="StateChartDebugger" parent="." instance=ExtResource("24_q5h8a")]
|
[node name="StateChartDebugger" parent="." instance=ExtResource("24_q5h8a")]
|
||||||
offset_left = 1530.0
|
offset_left = 1524.0
|
||||||
offset_top = 1.0
|
offset_top = 1.0
|
||||||
offset_right = -2.0
|
offset_right = -8.0
|
||||||
offset_bottom = 1.0
|
offset_bottom = 1.0
|
||||||
|
enabled = false
|
||||||
initial_node_to_watch = NodePath("../StateChart")
|
initial_node_to_watch = NodePath("../StateChart")
|
||||||
|
|
||||||
|
[node name="UI" type="CanvasLayer" parent="."]
|
||||||
|
script = ExtResource("30_2ghaa")
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="UI"]
|
||||||
|
offset_right = 128.0
|
||||||
|
offset_bottom = 81.0
|
||||||
|
|
||||||
|
[node name="DashesLabel" type="Label" parent="UI/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Dashes"
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="UI/VBoxContainer"]
|
||||||
|
custom_minimum_size = Vector2(0, 30)
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Dash1" type="TextureRect" parent="UI/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
texture = ExtResource("30_h23go")
|
||||||
|
expand_mode = 2
|
||||||
|
|
||||||
|
[node name="Dash2" type="TextureRect" parent="UI/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
texture = ExtResource("30_h23go")
|
||||||
|
expand_mode = 2
|
||||||
|
|
||||||
|
[node name="Dash3" type="TextureRect" parent="UI/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
texture = ExtResource("30_h23go")
|
||||||
|
expand_mode = 2
|
||||||
|
|
||||||
[node name="StateChart" type="Node" parent="."]
|
[node name="StateChart" type="Node" parent="."]
|
||||||
script = ExtResource("25_wv70j")
|
script = ExtResource("25_wv70j")
|
||||||
metadata/_custom_type_script = "uid://couw105c3bde4"
|
metadata/_custom_type_script = "uid://couw105c3bde4"
|
||||||
|
26
player_controller/PlayerUi.cs
Normal file
26
player_controller/PlayerUi.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
public partial class PlayerUi : CanvasLayer
|
||||||
|
{
|
||||||
|
private TextureRect[] _dashIcons = new TextureRect[3];
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
base._Ready();
|
||||||
|
|
||||||
|
_dashIcons[0] = GetNode<TextureRect>("VBoxContainer/HBoxContainer/Dash1");
|
||||||
|
_dashIcons[1] = GetNode<TextureRect>("VBoxContainer/HBoxContainer/Dash2");
|
||||||
|
_dashIcons[2] = GetNode<TextureRect>("VBoxContainer/HBoxContainer/Dash3");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetNumberOfDashesLeft(int numberOfDashes)
|
||||||
|
{
|
||||||
|
int index = 1;
|
||||||
|
foreach (var dashIcon in _dashIcons)
|
||||||
|
{
|
||||||
|
dashIcon.SetVisible(index <= numberOfDashes);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1
player_controller/PlayerUi.cs.uid
Normal file
1
player_controller/PlayerUi.cs.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://bhuwv2nlcrunt
|
@ -23,6 +23,7 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
public Node3D WeaponRoot;
|
public Node3D WeaponRoot;
|
||||||
public WeaponSystem WeaponSystem;
|
public WeaponSystem WeaponSystem;
|
||||||
public WallHugSystem WallHugSystem;
|
public WallHugSystem WallHugSystem;
|
||||||
|
public PlayerUi PlayerUi;
|
||||||
|
|
||||||
private bool _movementEnabled = true;
|
private bool _movementEnabled = true;
|
||||||
|
|
||||||
@ -53,7 +54,16 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
[Export(PropertyHint.Range, "0,5,1,or_greater")]
|
[Export(PropertyHint.Range, "0,5,1,or_greater")]
|
||||||
public int MaxNumberOfDashActions { get; set; } = 1;
|
public int MaxNumberOfDashActions { get; set; } = 1;
|
||||||
|
|
||||||
public int DashActionsLeft { get; set; }
|
private int _dashActionsLeft;
|
||||||
|
public int DashActionsLeft
|
||||||
|
{
|
||||||
|
get => _dashActionsLeft;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_dashActionsLeft = value;
|
||||||
|
PlayerUi.SetNumberOfDashesLeft(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool _isWallJumpAvailable = true;
|
private bool _isWallJumpAvailable = true;
|
||||||
|
|
||||||
@ -87,6 +97,7 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
|
|
||||||
// General use stuff
|
// General use stuff
|
||||||
TweenQueueSystem = GetNode<TweenQueueSystem>("TweenQueueSystem");
|
TweenQueueSystem = GetNode<TweenQueueSystem>("TweenQueueSystem");
|
||||||
|
PlayerUi = GetNode<PlayerUi>("UI");
|
||||||
// Node3D mapNode = GetTree().Root.FindChild("Map", true, false) as Node3D;
|
// Node3D mapNode = GetTree().Root.FindChild("Map", true, false) as Node3D;
|
||||||
|
|
||||||
// Camera stuff
|
// Camera stuff
|
||||||
@ -204,8 +215,8 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
_aiming.StateEntered += OnAimingEntered;
|
_aiming.StateEntered += OnAimingEntered;
|
||||||
_aiming.StateExited += ResetTimeScale;
|
_aiming.StateExited += ResetTimeScale;
|
||||||
|
|
||||||
_crouched.StatePhysicsProcessing += HandleGroundedCrouched;
|
/*_crouched.StatePhysicsProcessing += HandleGroundedCrouched;
|
||||||
_standing.StatePhysicsProcessing += HandleGroundedStanding;
|
_standing.StatePhysicsProcessing += HandleGroundedStanding;*/
|
||||||
_grounded.StateEntered += OnGrounded;
|
_grounded.StateEntered += OnGrounded;
|
||||||
_grounded.StatePhysicsProcessing += HandleGrounded;
|
_grounded.StatePhysicsProcessing += HandleGrounded;
|
||||||
_airborne.StatePhysicsProcessing += HandleAirborne;
|
_airborne.StatePhysicsProcessing += HandleAirborne;
|
||||||
@ -286,16 +297,6 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
_isWallJumpAvailable = true;
|
_isWallJumpAvailable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnStanding()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnCrouched()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool CanPerformDashAction()
|
public bool CanPerformDashAction()
|
||||||
{
|
{
|
||||||
return DashActionsLeft > 0 && _dashCooldownTimer.IsStopped();
|
return DashActionsLeft > 0 && _dashCooldownTimer.IsStopped();
|
||||||
@ -303,7 +304,7 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
|
|
||||||
public void PerformDashAction()
|
public void PerformDashAction()
|
||||||
{
|
{
|
||||||
_isWallJumpAvailable = true;
|
_isWallJumpAvailable = true;
|
||||||
_dashCooldownTimer.Start();
|
_dashCooldownTimer.Start();
|
||||||
DashActionsLeft--;
|
DashActionsLeft--;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ ProjectUISoundController="*res://addons/maaacks_game_template/base/scenes/autolo
|
|||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
window/size/viewport_width=1980
|
window/size/viewport_width=1920
|
||||||
window/size/viewport_height=1080
|
window/size/viewport_height=1080
|
||||||
|
|
||||||
[dotnet]
|
[dotnet]
|
||||||
|
Reference in New Issue
Block a user