Looking for a guide on how to interact with the game
haggs opened this issue · 2 comments
Hey all,
I'm planning to use this to add Tetris to my application. I'm wondering how my consuming app will be able to handle the event where the game ends, and to start a new game after that. I noticed your demo the pieces pile up and the game bugs out when you hit the top and the game should end. Can you update your readme with how an app can handle game end / game start, as well as fetching the score?
Hello again! The conversion to TypeScript is really motivated by problems like this one. At the moment, there's really no way to proceed once the game ends.
The game's state is spread out and managed by a series of singletons, so there's no nice way to reset everything. Now that types are in place, I think I'll be able to rearrange some things to make starting a new game easy. Those changes should make it easy to test too. Currently the repo has no tests...
So I'm hoping to improve some things. Not sure yet when they'll be done, but it's motivating to see that you're interested.
hey @haggs, i updated the readme and released v0.2.0
with support for detecting when the game ends and starting a new game. this repo deserves more of a full guide at some point, but hopefully the current state of affairs gives you enough to work with. let me know if you run into any trouble!