Task #17: Propane Torch sprays a band of fire
Hit test: _band_hit replaces the torch's cone. It hits the enemies in a torch_width (1.6 m) wide band along the gun's line, from the scarecrow's center out to torch_range (4.5 m) past the muzzle, each enemy's hit radius added. The nearest torch_targets with a clear line are hit; _cone_hit and _band_hit share _hit_nearest. torch_arc is gone, and the torch joins MUZZLE_WEAPONS so scripted aim matches the mouse. Flame: TorchFlame (CPUParticles3D jet plus a flickering light) is sized to the band. WeaponModels gains a reusable held-effect pattern for #18: - add_held_effect / lit / douse / advance. - attack() lights the effect for HOLD_TICKS (1.5) tick intervals instead of replaying the kick. - douse() puts it out the moment fire is let go; it then fades for the particle lifetime. - Timers run on the sim clock (ScarecrowCombat.tick), or on physics frames when nothing advances them. That covers the other scarecrow on the partner's machine, which the existing "attack" events light, so there is no protocol change. Sound: a new burned signal and a "burn" cue (synth torch_roar.wav, generated by synth_audio.gd with its own seed) replace the pitchfork's stab sound. Tests (test_weapons): band in, beside, behind and beyond; a melee hugger is burned; held fire over 5 intervals ticks 5 times and stops on release; the flame is lit at every step while held and hidden after release; the replica and attack-event paths; the flame follows the model's yaw. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
26b735d3e6
commit
ca8601029e
12 changed files with 483 additions and 37 deletions
|
|
@ -8,6 +8,8 @@ extends SceneTree
|
|||
## truck_horn.wav beep-beep (the farmers are home)
|
||||
## pitchfork_whoosh.wav a quick swish through the air (a stab)
|
||||
## pumpkin_boom.wav a deep thump, a burst of noise, and a wet splat (a pumpkin bomb)
|
||||
## torch_roar.wav a gas jet's flickering roar and hiss with a few crackles (a propane
|
||||
## torch tick; back-to-back plays blend into one roar)
|
||||
## Loops carry a WAV 'smpl' loop point, so the importer's "Detect From WAV" loops them; every
|
||||
## periodic part of a loop has a whole number of cycles in it and filtered noise is warmed up
|
||||
## on the loop's own tail, so the seam is silent. Run with the editor closed, then let the
|
||||
|
|
@ -36,6 +38,8 @@ func _initialize() -> void:
|
|||
_rng.seed = 13
|
||||
_write("pitchfork_whoosh.wav", _whoosh(0.22), false)
|
||||
_write("pumpkin_boom.wav", _boom(0.9), false)
|
||||
_rng.seed = 17 # its own seed, so adding it changed none of the sounds above
|
||||
_write("torch_roar.wav", _roar(0.42), false)
|
||||
quit(0)
|
||||
|
||||
|
||||
|
|
@ -247,6 +251,29 @@ func _boom(length: float) -> PackedFloat32Array:
|
|||
return _normalize(buf, 0.85)
|
||||
|
||||
|
||||
## A propane torch: a low roar of noise and a breathy hiss, flickering, with a few crackles. It
|
||||
## swells in fast and dies away slowly, so plays one torch tick apart (shorter than it) overlap
|
||||
## into one steady roar while the torch is held.
|
||||
func _roar(length: float) -> PackedFloat32Array:
|
||||
var n := int(length * RATE)
|
||||
var roar := _noise_lowpass(n, 650.0)
|
||||
var hiss := _noise_lowpass(n, 5200.0)
|
||||
var hiss_low := _noise_lowpass(n, 1700.0)
|
||||
var flicker := _noise_lowpass(n, 16.0)
|
||||
var buf := PackedFloat32Array()
|
||||
buf.resize(n)
|
||||
for i in n:
|
||||
var u := float(i) / n
|
||||
var env := minf(u / 0.12, 1.0) * minf((1.0 - u) / 0.45, 1.0)
|
||||
buf[i] = env * (0.75 + 0.25 * flicker[i]) * (roar[i] + 0.4 * (hiss[i] - hiss_low[i]))
|
||||
for k in 7: # crackles: tiny sharp clicks
|
||||
var at := _rng.randi_range(int(0.08 * n), int(0.75 * n))
|
||||
var amp := _rng.randf_range(0.25, 0.55)
|
||||
for j in int(0.005 * RATE):
|
||||
buf[at + j] += amp * exp(-float(j) / (0.0012 * RATE)) * _rng.randf_range(-1.0, 1.0)
|
||||
return _normalize(buf, 0.7)
|
||||
|
||||
|
||||
func _horn() -> PackedFloat32Array:
|
||||
var n := int(0.9 * RATE)
|
||||
var buf := PackedFloat32Array()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue