Here’s a bit of fun. Over at piecesofpi.co.uk, Stephen has created a Tetris implementation using a Python library that allows the use of a Ciseco PiLite as a display. Read more here – the code is available on GitHub. See a video of it in action below:
Hi Michael,
Thanks for the plug. Stephen’s the name.
Guess I need a bio on the blog!
Cheers,
Stephen
No worries – brilliant project 🙂 I shall update with your name!
Thank you for publishing this, really works well 🙂
Been looking for things to show off the Pilite and this does it very well.
Steve
You’re very welcome, glad you enjoyed it!
Stephen
Hi – thanks for sharing the game! I`m a beginner in Python and now I try to figure out what each line does by messing around with the code. For example, I tried to make the game start again after it ends, but I couldn`t figure it out. Could you please tell me how to do that? Love your blog – greetings from Germany!
Hello Germany! 🙂 I *think* you want to put the main game loop (129-225) inside a function. Then, call that function to start the game off. You then need to NOT call pygame.quit() and sys.exit() but instead have the function call itself again. Or, you have the initial function call inside a While True: loop. There’s a couple of different ways to do it. I haven’t got a PiLite myself to try it out otherwise I’d do it and show you. Let me know how you get on!
Hi guys,
I’d advise against the function calling itself over and over again, because resources will be used on each call and never freed. Using ‘While True’ would definitely be better.
Stephen