Achievments unlocked! Highscore saved!


Well, well, well... I thought that this would take longer. Way longer. Instead I managed to implement some basic achievments with 24h. Wow!

But that wow quickly fades if I look at the code. As said last time a readable code is mandatory if I want to carry this any further. And the way the achievments work right now can only be describe as an utter mess. This will definitely need some time to refactor. But for the time beeing I proudly present them to you. Because, playing the game you won't notice the mess. At least I hope — please leave a comment if you find a bug!

Some details for the curious: The achievments are about time you played, the score you earned, how many points you missed and how close you managed to evade an eviv, blue square. Each achievment comes in four tiers: bronze, silver, gold and diamond. But when exactly each tier gets unlocked I'll keep a secret. Just play the game right now in your web broswer (even works on mobile!) to find out yourself! ;)

And even more details how the achievments system works on a code level: It's a simple dictionary holding the tiers for each achievment. If you unlock one, like playing one minute in one go, achievments["time"] simply gets set to 1. In the start/ end screen this can be read and translated to bronze, silver, gold or diamond. 

And that's the culprit of it all, I guess. A dictionary. https://gameprogrammingpatterns.com/observer.html has a pretty interesting article concerning an achievment system. I should've read that beforehand. But where's the fun then? And besides fun: This project (as any other on my page) is about learning. And the best way I learn is by doing. So I've done my bad achievment system and already see the limitations. Now I can go on and read that article to not only understand how it should be done, but I'll know exactly why it should be this way. Because I know how it goes if done any other way... ;)

Oh, and did I mention? We've highscores now! But in the end, highscores are nothing more than a special kind of achievment, aren't they? So it was not a big deal code wise. Although the code is messy I've added them in a few minutes.

PS: Have you noticed? The blocks don't spawn random any more. Now you can learn when and how they fall and play it blind folded. If you're crazy enough... ;)

Leave a comment

Log in with itch.io to leave a comment.