![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | AALivingMan |
I only recently began learning Godot and GDScript, so please bear with me here. I want to implement cheat codes into a game similar to how GTA does it, where you can type in a phrase and execute a function. I searched about this and I found various methods of doing it, but none of them explain clearly how it works and just throw code out.
Can anyone explain an efficient method of adding these cheat codes?
Have your cheat list stored with expected behaviors
The GTA Hidden way
When a key is pressed start a cheat-listener function
func is_cheating():
Check if another key is pressed within a certain time
else ignore and consider it as movement key
If another key is pressed within expected time frame
compare a concatenated String or Unicode to entries
in your stored cheat list
if cheat is stored in list
call cheat function with expected behavior
The Console/Promo-Code way
Have an input field for the code
when enter/accept pressed compare to stored code list
execute expected behavior
Wakatta | 2020-12-28 01:25