Skip to content

Commit

Permalink
Update PlayState.hx
Browse files Browse the repository at this point in the history
  • Loading branch information
Joalor64GH authored Nov 24, 2024
1 parent 0b60c34 commit 7e42807
Showing 1 changed file with 30 additions and 14 deletions.
44 changes: 30 additions & 14 deletions source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -455,21 +455,37 @@ class PlayState extends ExtendableState {
}
}

var konamiSequence:Array<String> = ['up', 'up', 'down', 'down', 'left', 'right', 'left', 'right'];

for (key in konamiSequence){
if (Input.justPressed(key)) {
if (key == konamiSequence[konami]) {
konami++;
if (konami == 8) {
FlxG.sound.play(Paths.sound('unlock'));
didKonami = true;
konami = 0;
}
} else
konami = 0;
if (Input.justPressed('left')) {
if (konami == 4 || konami == 6) {
konami++;
} else {
konami = 0;
}
}
if (Input.justPressed('down')) {
if (konami == 2 || konami == 3) {
konami++;
} else {
konami = 0;
}
}
if (Input.justPressed('up')) {
if (konami == 0 || konami == 1) {
konami++;
} else {
konami = 0;
}
}
if (Input.justPressed('right')) {
if (konami == 5 || konami == 7) {
konami++;
if (konami > 7) {
FlxG.sound.play(Paths.sound('unlock'));
didKonami = true;
}
} else {
konami = 0;
}
break;
}

for (i in 0...justPressed.length) {
Expand Down

0 comments on commit 7e42807

Please sign in to comment.