dash speed 3x, slam visual/damage fix

This commit is contained in:
2026-06-10 22:36:47 +03:00
parent 09c39e068b
commit 4fc64dedae
3 changed files with 60 additions and 91 deletions
+27 -24
View File
@@ -31,8 +31,8 @@ var _active_ability: int = -1
var _dash_dir: Vector3 = Vector3.ZERO
var _bull_anim: AnimationPlayer = null
var _charge_overlay: ColorRect = null
var _charge_ready_emitter: CPUParticles3D = null
var _slam_pending: bool = false
var _huff_player: AudioStreamPlayer = null
var _crowd_player: AudioStreamPlayer = null
@@ -121,15 +121,6 @@ func _setup_charge_indicators() -> void:
sphere.rings = 2
sphere.material = mat
# Screen overlay — red tint while charge-ahead (both buttons) is active
var ui := CanvasLayer.new()
add_child(ui)
_charge_overlay = ColorRect.new()
_charge_overlay.color = Color(0.9, 0.55, 0.0, 0.0)
_charge_overlay.mouse_filter = Control.MOUSE_FILTER_IGNORE
_charge_overlay.set_anchors_preset(Control.PRESET_FULL_RECT)
ui.add_child(_charge_overlay)
# Orange spark burst when single-button charge hits max
var burst_ramp := Gradient.new()
burst_ramp.set_color(0, Color(1.0, 0.55, 0.0, 1.0))
@@ -262,16 +253,16 @@ func _activate_slam() -> void:
ability_cd[1] = DP.f("slam_cooldown")
_ability_active = true
_active_ability = 1
_ability_timer = 0.9
if _bull_anim and _bull_anim.has_animation(&"Armature|SLAM"):
_bull_anim.play(&"Armature|SLAM")
_ability_timer = _bull_anim.get_animation(&"Armature|SLAM").length
_legs.set(&"tail_ragdoll", true)
_spawn_slam_fx()
# Delay hit slightly so it lands when the first ring reaches the targets
get_tree().create_timer(0.15).timeout.connect(
func() -> void: _hit_matadors_radius(DP.f("slam_range"), DP.f("slam_strength"))
)
_slam_pending = true
var jump_vel := DP.f("slam_jump_velocity")
velocity.y = jump_vel
var air_time := jump_vel / 9.8 * 2.0
_ability_timer = air_time + 0.5
if _bull_anim and _bull_anim.has_animation(&"Armature|SLAM"):
var anim_len := _bull_anim.get_animation(&"Armature|SLAM").length
_bull_anim.speed_scale = anim_len / maxf(air_time, 0.01)
_bull_anim.play(&"Armature|SLAM")
func _activate_dash() -> void:
@@ -592,12 +583,16 @@ func _physics_process(delta: float) -> void:
_active_ability = -1
_legs.set(&"charge_pitch_target", 0.0)
_legs.set(&"tail_ragdoll", false)
_slam_pending = false
if _bull_anim:
_bull_anim.speed_scale = 1.0
# ── Mouse button single-thrust actions ───────────────────────────────────────
# Left only → thrust NE (forward-right diagonal)
# Right only → thrust NW (forward-left diagonal)
var left_held := Input.is_action_pressed(&"thrust_left")
var right_held := Input.is_action_pressed(&"thrust_right")
camera_pivot.call(&"set_charge_active", left_held and right_held)
if left_held and right_held:
_thrust_left_charge = 0.0
@@ -628,11 +623,6 @@ func _physics_process(delta: float) -> void:
_charge_ready_emitter.restart()
_charge_was_full = either_full
# Briefly flash overlay when dash is active
var target_alpha := 0.20 if (_active_ability == 2 and _ability_active) else 0.0
var oc := _charge_overlay.color
_charge_overlay.color = Color(oc.r, oc.g, oc.b, lerpf(oc.a, target_alpha, delta * 12.0))
# Reset kick timer on landing so the first kick after a bounce is immediate
if on_floor and not _was_on_floor and direction:
_kick_timer = 0.0
@@ -681,6 +671,19 @@ func _physics_process(delta: float) -> void:
if impact > DP.f("bounce_min_impact"):
velocity.y = impact * DP.f("bounce_restitution")
# ── Slam landing ──────────────────────────────────────────────────────────
if _slam_pending and is_on_floor() and not _was_on_floor:
_slam_pending = false
_ability_active = false
_active_ability = -1
_ability_timer = 0.0
_legs.set(&"charge_pitch_target", 0.0)
_legs.set(&"tail_ragdoll", false)
if _bull_anim:
_bull_anim.speed_scale = 1.0
_spawn_slam_fx()
_hit_matadors_radius(DP.f("slam_range"), DP.f("slam_strength"))
# ── Dust ──────────────────────────────────────────────────────────────────
if flat_speed > DP.f("dust_charge_spd") and on_floor:
_set_dust_state(DustState.CHARGE)