cooldowns, sword holstering, ability colors

This commit is contained in:
2026-06-25 00:10:40 +03:00
parent 708a35d51f
commit b929ed2a7a
6 changed files with 268 additions and 124 deletions
+32 -12
View File
@@ -45,6 +45,8 @@ var _roll_damping: float = 0.15
enum DustState { NONE, WALK, CHARGE }
var _dust_state: DustState = DustState.NONE
var _walk_dust_ramp: Gradient = null
var _charge_dust_ramp: Gradient = null
func _ready() -> void:
@@ -79,9 +81,14 @@ func _setup_hoof_dust() -> void:
sphere.rings = 2
sphere.material = mat
var ramp := Gradient.new()
ramp.set_color(0, Color(0.80, 0.69, 0.46, 1.0))
ramp.set_color(1, Color(0.80, 0.69, 0.46, 0.0))
_walk_dust_ramp = Gradient.new()
_walk_dust_ramp.set_color(0, Color(0.80, 0.69, 0.46, 1.0))
_walk_dust_ramp.set_color(1, Color(0.80, 0.69, 0.46, 0.0))
# Light blue dust while charging
_charge_dust_ramp = Gradient.new()
_charge_dust_ramp.set_color(0, Color(0.20, 0.40, 0.85, 1.0))
_charge_dust_ramp.set_color(1, Color(0.20, 0.40, 0.85, 0.0))
var scale_curve := Curve.new()
scale_curve.add_point(Vector2(0.0, 0.2))
@@ -105,7 +112,7 @@ func _setup_hoof_dust() -> void:
p.scale_amount_min = DP.f("walk_scale_min")
p.scale_amount_max = DP.f("walk_scale_max")
p.mesh = sphere
p.color_ramp = ramp
p.color_ramp = _walk_dust_ramp
p.scale_amount_curve = scale_curve
cube_guy.add_child(p)
_hoof_emitters.append(p)
@@ -185,12 +192,14 @@ func _set_dust_state(new_state: DustState) -> void:
DustState.NONE:
p.emitting = false
DustState.WALK:
p.color_ramp = _walk_dust_ramp
p.scale_amount_min = DP.f("walk_scale_min")
p.scale_amount_max = DP.f("walk_scale_max")
p.initial_velocity_min = DP.f("walk_vel_min")
p.initial_velocity_max = DP.f("walk_vel_max")
p.emitting = true
DustState.CHARGE:
p.color_ramp = _charge_dust_ramp
p.scale_amount_min = DP.f("charge_scale_min")
p.scale_amount_max = DP.f("charge_scale_max")
p.initial_velocity_min = DP.f("charge_vel_min")
@@ -237,6 +246,10 @@ func ability_cooldown_fraction(slot: int) -> float:
return ability_cd[slot] / maxcd if maxcd > 0.0 else 0.0
func ability_cooldown_remaining(slot: int) -> float:
return ability_cd[slot]
func _activate_kick() -> void:
ability_cd[0] = DP.f("kick_cooldown")
_ability_active = true
@@ -261,8 +274,10 @@ func _activate_slam() -> void:
_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
# Airtime with an accelerated descent: rise (v/g) + fall (v / (g·√mult)).
var fall_mult := maxf(DP.f("slam_fall_mult"), 0.01)
var air_time := (jump_vel / 9.8) * (1.0 + 1.0 / sqrt(fall_mult))
_ability_timer = air_time + 0.3
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)
@@ -301,7 +316,7 @@ func _hit_matadors_cone(range_m: float, half_angle_rad: float, strength: float,
mat.call(&"apply_ability_hit", (forward + Vector3.UP * 0.4).normalized(), strength)
func _hit_matadors_radius(range_m: float, strength: float) -> void:
func _hit_matadors_radius(range_m: float, strength: float, up_boost: float = 0.0) -> void:
for mat: Node in get_tree().get_nodes_in_group(&"matador"):
var to_mat: Vector3 = (mat as Node3D).global_position - global_position
to_mat.y = 0.0
@@ -309,7 +324,7 @@ func _hit_matadors_radius(range_m: float, strength: float) -> void:
continue
var away := to_mat.normalized() if to_mat.length() > 0.01 \
else Vector3(randf() - 0.5, 0.0, randf() - 0.5).normalized()
mat.call(&"apply_ability_hit", (away + Vector3.UP * 0.6).normalized(), strength)
mat.call(&"apply_ability_hit", (away + Vector3.UP * 0.6).normalized(), strength, up_boost)
func _spawn_slam_fx() -> void:
@@ -424,8 +439,8 @@ func _spawn_kick_dust(origin: Vector3, back_dir: Vector3) -> void:
sphere.material = mat
var ramp := Gradient.new()
ramp.set_color(0, Color(0.80, 0.68, 0.42, 0.9))
ramp.set_color(1, Color(0.80, 0.68, 0.42, 0.0))
ramp.set_color(0, Color(1.0, 0.78, 0.18, 0.95))
ramp.set_color(1, Color(1.0, 0.45, 0.05, 0.0))
var scale_curve := Curve.new()
scale_curve.add_point(Vector2(0.0, 0.3))
@@ -566,7 +581,12 @@ func _apply_kick(direction: Vector3) -> void:
func _physics_process(delta: float) -> void:
# ── Gravity ───────────────────────────────────────────────────────────────
if not is_on_floor():
velocity += get_gravity() * delta
var gravity := get_gravity()
# Crash a slam down hard: full leap on the way up, accelerated descent so
# the bull spends less time floating before the impact.
if _slam_pending and velocity.y < 0.0:
gravity *= DP.f("slam_fall_mult")
velocity += gravity * delta
# ── Camera-relative input direction ───────────────────────────────────────
var input_dir := Input.get_vector("move_left", "move_right", "move_forward", "move_back")
@@ -686,7 +706,7 @@ func _physics_process(delta: float) -> void:
if _bull_anim:
_bull_anim.speed_scale = 1.0
_spawn_slam_fx()
_hit_matadors_radius(DP.f("slam_range"), DP.f("slam_strength"))
_hit_matadors_radius(DP.f("slam_range"), DP.f("slam_strength"), DP.f("slam_launch_up"))
# ── Dust ──────────────────────────────────────────────────────────────────
if flat_speed > DP.f("dust_charge_spd") and on_floor: