Added Glitch Room Source code to Gitty

This commit is contained in:
Jeff Luke committed 2026-10-04 11:31:17 -07:00
commit 1ac9eb5644
505 files changed
+28504

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
extends Node
var tracks: Dictionary = {}
var voice := AudioStreamPlayer.new()
var gates: Dictionary = {}
func _ready() -> void:
for name in ["human-die","startup","electrode-explode","level-transition","spheroid-spawn","enforcer-fire","player-lazer","grunt-walk","human-save","robot-explode","player-death","game-start","tank-explode","tank-projectile-bounce","tank-fire","quark-spawn","brain-explode","prog-transformation","human-to-prog","extra-life","high-score-top","brain-wave-start","spheroid-pop"]:
tracks[name] = load("res://games/robotron/audio/"+name+".wav")
voice.volume_db = -15
add_child(voice)
func effect(name: String) -> void:
if get_parent().demo or not get_parent().sound_enabled or not tracks.has(name): return
var now := Time.get_ticks_msec()
if now<int(gates.get(name,0)): return
# Limit repeated triggers while allowing each accepted sound to replace the last.
gates[name] = now+(90 if name=="player-lazer" else 180)
voice.stop()
voice.stream = tracks[name]
voice.play()
func stop_all() -> void:
voice.stop()
gates.clear()