When charging with both buttons, see red

This commit is contained in:
2026-05-25 21:08:43 +03:00
parent d98a5ba0ac
commit 866cc12c2c
+13 -27
View File
@@ -7,7 +7,6 @@ const HOOF_OFFSETS: Array = [
Vector3(-0.30, -0.25, 0.60), Vector3(-0.30, -0.25, 0.60),
Vector3( 0.30, -0.25, 0.60), Vector3( 0.30, -0.25, 0.60),
] ]
const SNOUT_OFFSET: Vector3 = Vector3(0.0, 0.5, -1.0)
@onready var camera_pivot: Node3D = $Camera3D @onready var camera_pivot: Node3D = $Camera3D
@onready var cube_guy: Node3D = $bull_v10 @onready var cube_guy: Node3D = $bull_v10
@@ -24,7 +23,7 @@ var _thrust_left_charge: float = 0.0
var _thrust_right_charge: float = 0.0 var _thrust_right_charge: float = 0.0
var _charge_was_full: bool = false var _charge_was_full: bool = false
var _snort_emitter: CPUParticles3D = null var _charge_overlay: ColorRect = null
var _charge_ready_emitter: CPUParticles3D = null var _charge_ready_emitter: CPUParticles3D = null
enum DustState { NONE, WALK, CHARGE } enum DustState { NONE, WALK, CHARGE }
@@ -106,28 +105,14 @@ func _setup_charge_indicators() -> void:
sphere.rings = 2 sphere.rings = 2
sphere.material = mat sphere.material = mat
# Snort steam from nose during charge-ahead (both buttons held) # Screen overlay — red tint while charge-ahead (both buttons) is active
var snort_ramp := Gradient.new() var ui := CanvasLayer.new()
snort_ramp.set_color(0, Color(0.95, 0.95, 0.95, 0.9)) add_child(ui)
snort_ramp.set_color(1, Color(0.80, 0.80, 0.80, 0.0)) _charge_overlay = ColorRect.new()
_charge_overlay.color = Color(0.7, 0.05, 0.0, 0.0)
_snort_emitter = CPUParticles3D.new() _charge_overlay.mouse_filter = Control.MOUSE_FILTER_IGNORE
_snort_emitter.position = SNOUT_OFFSET _charge_overlay.set_anchors_preset(Control.PRESET_FULL_RECT)
_snort_emitter.emitting = false ui.add_child(_charge_overlay)
_snort_emitter.amount = 6
_snort_emitter.lifetime = 0.35
_snort_emitter.explosiveness = 0.0
_snort_emitter.randomness = 0.5
_snort_emitter.local_coords = true
_snort_emitter.direction = Vector3(0.0, 0.2, -1.0).normalized()
_snort_emitter.spread = 25.0
_snort_emitter.initial_velocity_min = 2.0
_snort_emitter.initial_velocity_max = 4.0
_snort_emitter.scale_amount_min = 0.3
_snort_emitter.scale_amount_max = 0.7
_snort_emitter.mesh = sphere
_snort_emitter.color_ramp = snort_ramp
cube_guy.add_child(_snort_emitter)
# Orange spark burst when single-button charge hits max # Orange spark burst when single-button charge hits max
var burst_ramp := Gradient.new() var burst_ramp := Gradient.new()
@@ -305,9 +290,10 @@ func _physics_process(delta: float) -> void:
_charge_ready_emitter.restart() _charge_ready_emitter.restart()
_charge_was_full = either_full _charge_was_full = either_full
# Snort while charge-ahead is active # Fade red overlay in while charge-ahead, out when released
if _snort_emitter.emitting != both_held: var target_alpha := 0.30 if both_held else 0.0
_snort_emitter.emitting = both_held var oc := _charge_overlay.color
_charge_overlay.color = Color(oc.r, oc.g, oc.b, lerpf(oc.a, target_alpha, delta * 10.0))
_both_held = both_held _both_held = both_held