- Edited
xyz Now its not playing a sound
class_name CheatCodeListener extends Node
signal code_entered(name)
var s: String
var cheats = {"gm_up gm_up gm_down gm_down gm_up gm_up gm_up gm_up" : "sonic 3 level select"}
func _input(e):
for a in InputMap.get_actions().filter(func(aa): return e.is_action_pressed(aa)).slice(0,1):
s += a if not s else " " + a
for k in cheats.keys(): if s.contains(k): code_entered.emit(cheats[k]); s = ""
code_entered.connect(Play_sound)
func Play_sound():
Global.debug =1
$"../Node2D/AudioStreamPlayer2".play()```