Raptorkillz Yes but they need to be mapped to some physical input events in order to work. Can you show a screenshot of your input map tab in the projects settings?
How would I add a cheat code to a title screen
xyz Here
- Edited
Raptorkillz As I said the built in actions may be "overriding" your defined actions if both are mapped to same input events. What gets printed as "current sequence" when you press left/righ/up/down actions?
You can try with this input function instead. It prioritizes last added actions:
func _input(e):
var actions = InputMap.get_actions().filter(func(aa): return e.is_action_pressed(aa))
if actions:
var a = actions[-1]
s += a if not s else " " + a
print("current sequence: ", s)
for k in cheats.keys(): if s.contains(k): cheat_code_entered.emit(cheats[k]); s = ""
xyz The script is giving me errors
Raptorkillz The script is giving me errors
List them
xyz I can't print anything to the console you forgot
Raptorkillz How do you know there are errors then?
- Edited
Raptorkillz Umm, the last code snippet I posted was just the _input()
function, not the whole script. It's meant to replace the previous _input()
function. The rest of the stuff still needs to be there. I thought that was self evident. If not, you should really attempt a much simpler project.
xyz Nope the code you gave me is still not working with the cheat
- Edited
Raptorkillz You need to stop saying "not working" because that's just useless information. Do your best to diagnose in what way it's not working, what is happening vs what you expect to happen and report that. Be verbose and precise. Otherwise, you're wasting everyone's time, including yours. No one will be able to help you if you don't provide as much information as possible. We're not looking at your screen and cannot read your mind.
xyz Its not playing a sound
Raptorkillz Monitor the value of 's' (either via printing, breakpoints, or a label) as you input actions, and report back what you get there.
xyz It works
Raptorkillz How so it works now but it didn't work half an hour ago?