Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6d967bf2bf | |||
| e87a228dd2 | |||
| e8ff01e097 |
@@ -97,8 +97,8 @@ func load_scene(scene_path : String, in_background : bool = false) -> void:
|
||||
if not _background_loading:
|
||||
change_scene_to_resource()
|
||||
return
|
||||
ResourceLoader.load_threaded_request(_scene_path)
|
||||
set_process(true)
|
||||
ResourceLoader.load_threaded_request(_scene_path)
|
||||
if _check_loading_screen() and not _background_loading:
|
||||
change_scene_to_loading_screen()
|
||||
|
||||
@@ -108,6 +108,7 @@ func _unhandled_key_input(event : InputEvent) -> void:
|
||||
get_tree().quit()
|
||||
|
||||
func _ready() -> void:
|
||||
process_mode = Node.PROCESS_MODE_ALWAYS
|
||||
set_process(false)
|
||||
|
||||
func _process(_delta) -> void:
|
||||
|
||||
@@ -24,6 +24,9 @@ use_collision = true
|
||||
size = Vector3(1, 17.5, 9.5)
|
||||
material = ExtResource("3_1qo78")
|
||||
|
||||
[node name="Player" parent="." index="7" unique_id=1309399929]
|
||||
transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, 3, 0, 0)
|
||||
|
||||
[node name="GroundedSpawner" parent="." index="8" unique_id=580981173 node_paths=PackedStringArray("Target") instance=ExtResource("4_jaqjx")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.5, 1, -42.5)
|
||||
EnemyToSpawn = ExtResource("5_iq67o")
|
||||
|
||||
@@ -39,6 +39,8 @@ transform = Transform3D(-0.1772511, 0.44628847, 0.87715954, 0.49540228, -0.72966
|
||||
|
||||
[node name="Player" parent="." index="6" unique_id=1309399929]
|
||||
transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, -0.5, 0.4102497, 0.5415039)
|
||||
HasSword = false
|
||||
HasParry = false
|
||||
|
||||
[node name="Greybox" type="CSGCombiner3D" parent="." index="7" unique_id=2082385716]
|
||||
use_collision = true
|
||||
|
||||
@@ -47,7 +47,7 @@ transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 35.5, 30.5, -42.5)
|
||||
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 26, 30.5, -42.5)
|
||||
|
||||
[node name="FixedDashthroughTarget7" parent="Targets" index="4" unique_id=282429016 instance=ExtResource("4_invhv")]
|
||||
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 10.5, 3.5, -9)
|
||||
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 10.5, 5.5, -9)
|
||||
|
||||
[node name="FixedDashthroughTarget6" parent="Targets" index="5" unique_id=437890277 instance=ExtResource("4_invhv")]
|
||||
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 8, 6, -30.5)
|
||||
@@ -236,37 +236,43 @@ Target = NodePath("../../Player")
|
||||
RHealth = SubResource("Resource_xy0m1")
|
||||
RMovement = SubResource("Resource_nwk5u")
|
||||
|
||||
[node name="Enemy7" parent="GroundedEnemies" index="18" unique_id=1389063523 node_paths=PackedStringArray("Target") instance=ExtResource("5_ofbe2")]
|
||||
[node name="Enemy27" parent="GroundedEnemies" index="18" unique_id=883912991 node_paths=PackedStringArray("Target") instance=ExtResource("5_ofbe2")]
|
||||
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 13.5, 0, 1.1631908)
|
||||
Target = NodePath("../../Player")
|
||||
RHealth = SubResource("Resource_xy0m1")
|
||||
RMovement = SubResource("Resource_nwk5u")
|
||||
|
||||
[node name="Enemy7" parent="GroundedEnemies" index="19" unique_id=1389063523 node_paths=PackedStringArray("Target") instance=ExtResource("5_ofbe2")]
|
||||
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 25.5, 4, -27.33681)
|
||||
Target = NodePath("../../Player")
|
||||
RHealth = SubResource("Resource_xy0m1")
|
||||
RMovement = SubResource("Resource_nwk5u")
|
||||
|
||||
[node name="Enemy10" parent="GroundedEnemies" index="19" unique_id=836898496 node_paths=PackedStringArray("Target") instance=ExtResource("5_ofbe2")]
|
||||
[node name="Enemy10" parent="GroundedEnemies" index="20" unique_id=836898496 node_paths=PackedStringArray("Target") instance=ExtResource("5_ofbe2")]
|
||||
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 30.5, 11, -33.336807)
|
||||
Target = NodePath("../../Player")
|
||||
RHealth = SubResource("Resource_xy0m1")
|
||||
RMovement = SubResource("Resource_nwk5u")
|
||||
|
||||
[node name="Enemy8" parent="GroundedEnemies" index="20" unique_id=1015624071 node_paths=PackedStringArray("Target") instance=ExtResource("5_ofbe2")]
|
||||
[node name="Enemy8" parent="GroundedEnemies" index="21" unique_id=1015624071 node_paths=PackedStringArray("Target") instance=ExtResource("5_ofbe2")]
|
||||
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 34.5, 1.5, -27.33681)
|
||||
Target = NodePath("../../Player")
|
||||
RHealth = SubResource("Resource_xy0m1")
|
||||
RMovement = SubResource("Resource_nwk5u")
|
||||
|
||||
[node name="Enemy9" parent="GroundedEnemies" index="21" unique_id=827865590 node_paths=PackedStringArray("Target") instance=ExtResource("5_ofbe2")]
|
||||
[node name="Enemy9" parent="GroundedEnemies" index="22" unique_id=827865590 node_paths=PackedStringArray("Target") instance=ExtResource("5_ofbe2")]
|
||||
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 46.5, 0, -27.33681)
|
||||
Target = NodePath("../../Player")
|
||||
RHealth = SubResource("Resource_xy0m1")
|
||||
RMovement = SubResource("Resource_nwk5u")
|
||||
|
||||
[node name="Enemy5" parent="GroundedEnemies" index="22" unique_id=1267116862 node_paths=PackedStringArray("Target") instance=ExtResource("5_ofbe2")]
|
||||
[node name="Enemy5" parent="GroundedEnemies" index="23" unique_id=1267116862 node_paths=PackedStringArray("Target") instance=ExtResource("5_ofbe2")]
|
||||
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 4, 0, -18.33681)
|
||||
Target = NodePath("../../Player")
|
||||
RHealth = SubResource("Resource_xy0m1")
|
||||
RMovement = SubResource("Resource_nwk5u")
|
||||
|
||||
[node name="Enemy6" parent="GroundedEnemies" index="23" unique_id=1147823180 node_paths=PackedStringArray("Target") instance=ExtResource("5_ofbe2")]
|
||||
[node name="Enemy6" parent="GroundedEnemies" index="24" unique_id=1147823180 node_paths=PackedStringArray("Target") instance=ExtResource("5_ofbe2")]
|
||||
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 16.5, 7, -17.33681)
|
||||
Target = NodePath("../../Player")
|
||||
RHealth = SubResource("Resource_xy0m1")
|
||||
|
||||
@@ -34,4 +34,5 @@ func add_levels_to_container() -> void:
|
||||
|
||||
func _on_level_buttons_container_item_activated(index: int) -> void:
|
||||
var level_to_load = scene_lister.files.get(index)
|
||||
level_selected.emit()
|
||||
SceneLoader.load_scene(level_to_load)
|
||||
|
||||
@@ -397,6 +397,7 @@ text = "Start"
|
||||
|
||||
[node name="ContinueGameButton" type="Button" parent="MenuContainer/MenuButtonsMargin/MenuButtonsContainer/MenuButtonsBoxContainer" index="1" unique_id=861746608]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "Continue"
|
||||
|
||||
|
||||
@@ -26,12 +26,16 @@ func _on_player_invicible_toggled(toggled_on: bool) -> void:
|
||||
|
||||
func _on_restart_current_level_pressed() -> void:
|
||||
SceneLoader.reload_current_scene()
|
||||
close()
|
||||
|
||||
|
||||
func _on_select_level_pressed() -> void:
|
||||
var menu: LevelSelectMenu = level_selection_menu.instantiate()
|
||||
menu.level_selected.connect(_on_level_selected)
|
||||
add_child(menu)
|
||||
|
||||
|
||||
func _on_level_selected() -> void:
|
||||
close()
|
||||
|
||||
func _on_player_health_changed(value: float) -> void:
|
||||
player.SetPlayerHealthOverride(value)
|
||||
|
||||
@@ -18,7 +18,7 @@ emission_enabled = true
|
||||
emission = Color(0, 0.68968636, 0.7473501, 1)
|
||||
|
||||
[node name="FixedDashthroughTarget" type="AnimatableBody3D" unique_id=1291663508]
|
||||
collision_layer = 288
|
||||
collision_layer = 32
|
||||
collision_mask = 0
|
||||
script = ExtResource("1_r0j7a")
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://bnwj7ltdfximr" path="res://icon.svg" id="30_h23go"]
|
||||
[ext_resource type="Texture2D" uid="uid://chvt6g0xn5c2m" path="res://scenes/player_controller/components/dash/light-ring.jpg" id="32_lgpc8"]
|
||||
[ext_resource type="Script" uid="uid://b4dwolbvt8our" path="res://addons/godot_state_charts/history_state.gd" id="41_ruloh"]
|
||||
[ext_resource type="Texture2D" uid="uid://c40orhfdgsim" path="res://assets/ui/IconGodotNode/white/icon_circle.png" id="45_u8rdp"]
|
||||
[ext_resource type="PackedScene" uid="uid://cyw8p0p6a78tl" path="res://scenes/ui/healthbar/healthbar.tscn" id="47_76kmc"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_cb2lu"]
|
||||
@@ -105,9 +106,6 @@ radius = 1.5
|
||||
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_2q0ik"]
|
||||
blend_mode = 1
|
||||
|
||||
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_ue7xq"]
|
||||
load_path = "res://.godot/imported/fireball.svg-da8480a7a8e47ac511e0971f6fa164bd.ctex"
|
||||
|
||||
[node name="Player" type="CharacterBody3D" unique_id=709076448]
|
||||
collision_mask = 272
|
||||
script = ExtResource("1_poq2x")
|
||||
@@ -507,7 +505,7 @@ offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = SubResource("CompressedTexture2D_ue7xq")
|
||||
texture = ExtResource("45_u8rdp")
|
||||
expand_mode = 1
|
||||
|
||||
[node name="Healthbar" parent="UI" unique_id=1462180337 instance=ExtResource("47_76kmc")]
|
||||
|
||||
@@ -281,6 +281,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
private float _playerHeight;
|
||||
private float _playerRadius;
|
||||
private Vector3 _dashDirection = Vector3.Zero;
|
||||
private Vector3 _postDashThroughPosition = Vector3.Zero;
|
||||
private Vector3 _preDashVelocity = Vector3.Zero;
|
||||
private int _empoweredActionsLeft;
|
||||
public int EmpoweredActionsLeft
|
||||
@@ -1781,20 +1782,32 @@ public partial class PlayerController : CharacterBody3D,
|
||||
// feet of the capsule
|
||||
var correction = DashSystem.CollisionNormal == Vector3.Down ? _playerHeight : DashSystem.DashCastRadius;
|
||||
var correctedLocation = DashSystem.PlannedLocation + Vector3.Down * correction;
|
||||
|
||||
var travel = correctedLocation - GlobalPosition;
|
||||
_dashDirection = travel.Normalized();
|
||||
|
||||
var shouldRebound = false;
|
||||
if (DashSystem.CanDashThroughTarget && DashSystem.CollidedObject is ITargetable targetable)
|
||||
correctedLocation = ComputePositionAfterTargetedDash(targetable.GetTargetGlobalPosition(), DashSystem.CollisionPoint);
|
||||
{
|
||||
var plannedDashLocation = targetable.GetTargetGlobalPosition() + Vector3.Down*_playerHeight/2;
|
||||
travel = plannedDashLocation - GlobalPosition;
|
||||
_dashDirection = travel.Normalized();
|
||||
var postDashLocation = plannedDashLocation + _dashDirection;
|
||||
var wallBehindQuery = PhysicsRayQueryParameters3D.Create(GlobalPosition + Vector3.Up*HeadSystem.Position.Y, postDashLocation, GroundDetector.CollisionMask);
|
||||
var wallBehindResult = _spaceState.IntersectRay(wallBehindQuery);
|
||||
shouldRebound = wallBehindResult.Count > 0;
|
||||
correctedLocation = shouldRebound ? plannedDashLocation : postDashLocation;
|
||||
}
|
||||
|
||||
// Start invincibility timer for the duration of the dash and a bit more afterwards
|
||||
OnHitInvincibility();
|
||||
|
||||
_preDashVelocity = Velocity;
|
||||
_dashDirection = (correctedLocation - GlobalPosition).Normalized();
|
||||
SetupDashDamageDetector(correctedLocation);
|
||||
|
||||
var dashTween = CreatePositionTween(correctedLocation, AimedDashTime);
|
||||
// dashTween.TweenMethod(Callable.From<float>(AimedDashTweenOngoing), 0.0f, 1.0f, AimedDashTime);
|
||||
dashTween.Finished += AimedDashTweenEnded;
|
||||
if (shouldRebound) dashTween.Finished += ManualKnockback;
|
||||
|
||||
_customMantle = DashSystem.ShouldMantle;
|
||||
_customMantleCurve = DashSystem.MantleSystem.MantleCurve;
|
||||
@@ -2093,28 +2106,35 @@ public partial class PlayerController : CharacterBody3D,
|
||||
}
|
||||
|
||||
private PhysicsDirectSpaceState3D _spaceState;
|
||||
|
||||
public void StartDashAction(bool isParry)
|
||||
{
|
||||
var streamName = isParry ? "parry" : "attacks";
|
||||
_audioStream!.SwitchToClipByName(streamName);
|
||||
IsInvincible = true;
|
||||
|
||||
var plannedDashLocation = _targetLocation + Vector3.Down*HeadSystem.Position.Y;
|
||||
var query = PhysicsRayQueryParameters3D.Create(HeadSystem.GlobalPosition, plannedDashLocation, DashSystem.DashCast3D.CollisionMask);
|
||||
var result = _spaceState.IntersectRay(query);
|
||||
if (result.Count > 0)
|
||||
{
|
||||
plannedDashLocation = (Vector3) result["position"];
|
||||
}
|
||||
var plannedDashLocation = _targetLocation + Vector3.Down*_playerHeight/2;
|
||||
// var enemySurfaceQuery = PhysicsRayQueryParameters3D.Create(HeadSystem.GlobalPosition, plannedDashLocation, DashSystem.DashCast3D.CollisionMask);
|
||||
// var enemySurfaceResult = _spaceState.IntersectRay(enemySurfaceQuery);
|
||||
// if (enemySurfaceResult.Count > 0)
|
||||
// {
|
||||
// plannedDashLocation = (Vector3) enemySurfaceResult["position"];
|
||||
// }
|
||||
|
||||
var travel = plannedDashLocation - (GlobalPosition + Vector3.Up*_playerHeight/2);
|
||||
_preDashVelocity = Velocity;
|
||||
var travel = plannedDashLocation - GlobalPosition;
|
||||
_dashDirection = travel.Normalized();
|
||||
|
||||
var postDashLocation = plannedDashLocation + _dashDirection;
|
||||
var wallBehindQuery = PhysicsRayQueryParameters3D.Create(GlobalPosition + Vector3.Up*HeadSystem.Position.Y, postDashLocation, GroundDetector.CollisionMask);
|
||||
var wallBehindResult = _spaceState.IntersectRay(wallBehindQuery);
|
||||
var shouldRebound = wallBehindResult.Count > 0;
|
||||
if (!shouldRebound) _postDashThroughPosition = postDashLocation;
|
||||
|
||||
var dashTween = CreatePositionTween(plannedDashLocation, AimedDashTime);
|
||||
if (isParry) dashTween.Finished += OnDashParryEnded;
|
||||
if (isParry || shouldRebound) dashTween.Finished += OnDashParryEnded;
|
||||
else dashTween.Finished += OnDashAttackEnded;
|
||||
}
|
||||
|
||||
public void OnDashAttackStarted()
|
||||
{
|
||||
StartDashAction(isParry: false);
|
||||
@@ -2142,13 +2162,18 @@ public partial class PlayerController : CharacterBody3D,
|
||||
public void OnDashAttackEnded()
|
||||
{
|
||||
StopDashAction();
|
||||
GlobalPosition = ComputePositionAfterTargetedDash(_targetLocation, _targetHitLocation);
|
||||
GlobalPosition = _postDashThroughPosition;
|
||||
var postDashVelocity = _preDashVelocity.Length() > PostDashSpeed ? _preDashVelocity.Length() : PostDashSpeed;
|
||||
Velocity = _dashDirection * postDashVelocity;
|
||||
}
|
||||
public void OnDashParryEnded()
|
||||
{
|
||||
StopDashAction();
|
||||
ManualKnockback();
|
||||
}
|
||||
|
||||
public void ManualKnockback()
|
||||
{
|
||||
Velocity = -_dashDirection*RKnockback.Modifier;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user