Skip to content
Advertisement

how can I make my pygame konami code simpler?

I am currently working on a pygame game and my friends asked if i could implement a konami code. I thought it was a great idea so i implemented it.

I made it in a way it would certainly work because I wouldnt have to deal with any errors. However.. the code got a bit larger then expected so i was wondering how i could make it smaller and still working because i dont know any good way to make it smaller.

the code:

JavaScript

Advertisement

Answer

You can store your konami code as a list of values. And then compare user input with that list:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement