1 Commits

Author SHA1 Message Date
e4880d42f9 feat: removed crouch and added a UI for available jumps
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 6s
Create tag and build when new code gets to main / Export (push) Successful in 3m40s
2025-07-06 15:11:25 +02:00
5 changed files with 81 additions and 20 deletions

View File

@ -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="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://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="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"]
height = 1.7
@ -42,7 +44,7 @@ height = 1.7
script = ExtResource("1_poq2x")
TimeScaleAimInAir = 0.15
MaxJumpBoostAfterDashing = 0.7
MaxNumberOfDashActions = 3
MaxNumberOfDashActions = 2
[node name="InputController" type="Node3D" parent="."]
script = ExtResource("16_v31n3")
@ -181,12 +183,43 @@ wait_time = 0.3
one_shot = true
[node name="StateChartDebugger" parent="." instance=ExtResource("24_q5h8a")]
offset_left = 1530.0
offset_left = 1524.0
offset_top = 1.0
offset_right = -2.0
offset_right = -8.0
offset_bottom = 1.0
enabled = false
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="."]
script = ExtResource("25_wv70j")
metadata/_custom_type_script = "uid://couw105c3bde4"

View 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++;
}
}
}

View File

@ -0,0 +1 @@
uid://bhuwv2nlcrunt

View File

@ -23,6 +23,7 @@ public partial class PlayerController : CharacterBody3D
public Node3D WeaponRoot;
public WeaponSystem WeaponSystem;
public WallHugSystem WallHugSystem;
public PlayerUi PlayerUi;
private bool _movementEnabled = true;
@ -52,9 +53,18 @@ public partial class PlayerController : CharacterBody3D
[Export(PropertyHint.Range, "0,5,1,or_greater")]
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 StateChart _playerState;
@ -87,6 +97,7 @@ public partial class PlayerController : CharacterBody3D
// General use stuff
TweenQueueSystem = GetNode<TweenQueueSystem>("TweenQueueSystem");
PlayerUi = GetNode<PlayerUi>("UI");
// Node3D mapNode = GetTree().Root.FindChild("Map", true, false) as Node3D;
// Camera stuff
@ -204,8 +215,8 @@ public partial class PlayerController : CharacterBody3D
_aiming.StateEntered += OnAimingEntered;
_aiming.StateExited += ResetTimeScale;
_crouched.StatePhysicsProcessing += HandleGroundedCrouched;
_standing.StatePhysicsProcessing += HandleGroundedStanding;
/*_crouched.StatePhysicsProcessing += HandleGroundedCrouched;
_standing.StatePhysicsProcessing += HandleGroundedStanding;*/
_grounded.StateEntered += OnGrounded;
_grounded.StatePhysicsProcessing += HandleGrounded;
_airborne.StatePhysicsProcessing += HandleAirborne;
@ -286,16 +297,6 @@ public partial class PlayerController : CharacterBody3D
_isWallJumpAvailable = true;
}
public void OnStanding()
{
}
public void OnCrouched()
{
}
public bool CanPerformDashAction()
{
return DashActionsLeft > 0 && _dashCooldownTimer.IsStopped();
@ -303,7 +304,7 @@ public partial class PlayerController : CharacterBody3D
public void PerformDashAction()
{
_isWallJumpAvailable = true;
_isWallJumpAvailable = true;
_dashCooldownTimer.Start();
DashActionsLeft--;
}

View File

@ -29,7 +29,7 @@ ProjectUISoundController="*res://addons/maaacks_game_template/base/scenes/autolo
[display]
window/size/viewport_width=1980
window/size/viewport_width=1920
window/size/viewport_height=1080
[dotnet]