How to make Konami Code for event?

Get help using Construct 2

Post » Sat Mar 31, 2012 7:39 pm

Im wondering how to make Konami Code for event? i had no idea how to code in following keys inside of Construct 2 event:


B
96
S
25
G
20
Posts: 3,055
Reputation: 22,646

Post » Sat Mar 31, 2012 8:39 pm

Every time one of the keys of the code is pressed append it to a text variable.

Do a system compare with right(length of code) equal to code to see if it's a match.


So say the code is udlra.
u for Up, d for Down, a for A, etc.
You events (-input events) would look like this:

Global text variable 'value'=""
System| compare right(value, 5) = "udlra"
---- Enable Cheat
R0J0hound2012-03-31 20:40:36
B
79
S
24
G
55
Posts: 4,755
Reputation: 41,273

Post » Sat Mar 31, 2012 11:08 pm

I don't understand that method, it makes me to confuse how to add keyboard keys...Do i add conditions?
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,646

Post » Mon Apr 02, 2012 1:04 am

There is .capx what i have done by that method and it doesn't work :(



.capx
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,646

Post » Mon Apr 02, 2012 2:15 am

Updated, it would work, but there were some events missing in the capx.

The keys needed to append a letter to the code, so if you press U,D or A buttons, the code would be "UDA"

I've uploaded a fixed version and demo.

http://www.johnnysix.net/games/kc/

http://www.johnnysix.net/games/kc/kfc.capx
Image
B
27
S
9
G
5
Posts: 487
Reputation: 11,939

Post » Mon Apr 02, 2012 2:27 am

Awesome! it perfectly works, even you can press random keys before to perform konami code and it still works!

Thank you for your help!
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,646

Post » Mon Apr 02, 2012 7:38 pm

It's what R0J0hound did with the right(value, 5) = "udlra"

so if you had right(SomeString,3) ="foo"

and Somestring = "akjhfldhjeuihuihefihefoo" it'll only check the rightmost characters.
Image
B
27
S
9
G
5
Posts: 487
Reputation: 11,939

Post » Sun Jun 24, 2012 8:40 pm

Very helpful. So if I wanted a cheat code that'll open up a menu I'll just have it go to a new layout once its been entered correct?
Image
B
57
S
14
G
6
Posts: 493
Reputation: 11,253

Post » Sun Feb 07, 2016 8:03 pm

How do I make the konami code spawn a charecter. I know how to type it and every thing but make it do something
B
6
Posts: 1
Reputation: 252

Post » Fri Mar 25, 2016 3:02 pm

Taha6666 wrote:How do I make the konami code spawn a charecter. I know how to type it and every thing but make it do something


In order to spawn an object, you need to already have one instance of this object on your layout.
Put it off your layout scene, or somewhere else with Opacity 0, then use your Konami Code event to create it and place it where you want.

I guess that's kind of the way to go for.
B
7
Posts: 8
Reputation: 348

Next

Return to How do I....?

Who is online

Users browsing this forum: Megavolt, selaus and 0 guests