How do I Implement a "Cheat Code" system?

  • What is the best way to make possible to enter a cheat code, that would be a word, during gameplay (or in pause menu, where the gameplay is stopped, if it's more simple)?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Well first you would have to decide how you want the cheat code entered. Is there somewhere a player can type like a text box? Or if they enter the correct sequence any time it will trigger during gameplay? Is there a chat system you already have in place, or maybe a console the player can bring up to enter a code?

  • Well first you would have to decide how you want the cheat code entered. Is there somewhere a player can type like a text box? Or if they enter the correct sequence any time it will trigger during gameplay? Is there a chat system you already have in place, or maybe a console the player can bring up to enter a code?

    It would be the "classic style", where you just have to enter the correct sequence os keys, without any text box. hehe

  • Ok here is how I would do it. Remember there are may ways to implement it.

    Basically, you have a variable that you keep appending text to to keep track of what keys are pressed. You'll use expressions to check if the last x characters in this variable match your cheat code then do something.

    I'll add in an event to delete the leftmost character after the variable is x length, so it doesn't keep growing forever.

    https://www.dropbox.com/s/ki12vj9ylgsc3 ... .capx?dl=0

  • Ok here is how I would do it. Remember there are may ways to implement it.

    Basically, you have a variable that you keep appending text to to keep track of what keys are pressed. You'll use expressions to check if the last x characters in this variable match your cheat code then do something.

    I'll add in an event to delete the leftmost character after the variable is x length, so it doesn't keep growing forever.

    https://www.dropbox.com/s/ki12vj9ylgsc3 ... .capx?dl=0

    That's exactly what I need! hehe

    Thank you very much!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)