ground slam damage depends on height #6
@@ -41,8 +41,8 @@ func _input(event : InputEvent) -> void:
|
||||
if event.is_action_released("ui_cancel"):
|
||||
if sub_menu:
|
||||
_close_sub_menu()
|
||||
else:
|
||||
get_tree().quit()
|
||||
# else:
|
||||
# get_tree().quit()
|
||||
if event.is_action_released("ui_accept") and get_viewport().gui_get_focus_owner() == null:
|
||||
%MenuButtonsBoxContainer.focus_first()
|
||||
|
||||
|
||||
@@ -112,5 +112,5 @@ tuto_text = "Try to survive!"
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0.625, -1.875)
|
||||
shape = SubResource("BoxShape3D_lthgu")
|
||||
|
||||
[node name="Player" parent="." index="15" unique_id=1309399929]
|
||||
[node name="Player" parent="." index="16" unique_id=1309399929]
|
||||
transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, 3, 0, 0)
|
||||
|
||||
@@ -77,7 +77,7 @@ metadata/_custom_type_script = "uid://jitubgv6judn"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_abfq8"]
|
||||
script = ExtResource("3_cb2lu")
|
||||
Modifier = 20.0
|
||||
Modifier = 5.0
|
||||
metadata/_custom_type_script = "uid://b44cse62qru7j"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_ue7xq"]
|
||||
|
||||
@@ -1933,6 +1933,8 @@ public partial class PlayerController : CharacterBody3D,
|
||||
///////////////////////////
|
||||
// Slam Management ///////
|
||||
///////////////////////////
|
||||
|
||||
private Vector3 _slamStartPosition = Vector3.Zero;
|
||||
public void OnInputSlamPressed()
|
||||
{
|
||||
_playerState.SendEvent("slam");
|
||||
@@ -1940,6 +1942,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
|
||||
public void SlamStarted()
|
||||
{
|
||||
_slamStartPosition = GlobalPosition;
|
||||
SetHorizontalVelocity(Vector2.Zero);
|
||||
SetVerticalVelocity(-SlamSpeed);
|
||||
_audioStream.SwitchToClipByName("dash");
|
||||
@@ -1950,11 +1953,16 @@ public partial class PlayerController : CharacterBody3D,
|
||||
}
|
||||
public void SlamEnded()
|
||||
{
|
||||
var distanceTraveled = GlobalPosition.DistanceTo(_slamStartPosition);
|
||||
HeadSystem.OnGetHit();
|
||||
_audioStream.SwitchToClipByName("slam");
|
||||
|
||||
if (Explosion.Instantiate() is not Explosion explosion) return;
|
||||
explosion.Radius = 10f;
|
||||
|
||||
// Basic distance traveled explosion manipulation
|
||||
explosion.Radius = distanceTraveled;
|
||||
explosion.RDamage.DamageDealt = distanceTraveled;
|
||||
|
||||
GetTree().GetRoot().AddChild(explosion);
|
||||
explosion.GlobalPosition = GlobalPosition;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user