How do I Implement a "Cheat Code" system?

Get help using Construct 2

Post » Thu May 05, 2016 5:28 pm

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)?
B
20
S
4
Posts: 387
Reputation: 2,274

Post » Thu May 05, 2016 5:40 pm

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?
Mistakes were made.
B
53
S
27
G
114
Posts: 1,699
Reputation: 64,446

Post » Thu May 05, 2016 5:53 pm

oosyrag wrote: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
B
20
S
4
Posts: 387
Reputation: 2,274

Post » Thu May 05, 2016 9:02 pm

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
Mistakes were made.
B
53
S
27
G
114
Posts: 1,699
Reputation: 64,446

Post » Thu May 05, 2016 10:37 pm

oosyrag wrote: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!
B
20
S
4
Posts: 387
Reputation: 2,274


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 18 guests