[share] Grid-based game for Pythonista
-
I have been working on a simple game to try to learn the Scene module. Feel free to try it. I would welcome feedback of any sort. I am a beginner and so my code will not be particularly tidy!
It consists of a few files (high score saving, configuration etc) and can be downloaded from GitHub here.
-
Thanks to @ccc for many useful edits. I've just learned a lot! :)
-
It would be nice if I could see my final score when the game ends.
-
@omz I have just committed a few changes on GitHub, including particle effects (hopefully tastefully minimal!) and the score persists at the end of a game until a new game is started.
-
Thanks! I'm starting to get the hang of this. :)
I noticed that the import for
random.uniform
was missing (see my pull request).
-
@chriswilson Another minor issue: In the
move_counters
method, I think it should beself.squares
in the list comprehensions (it's currentlyself.square
which is undefined).
-
Hi @omz
I'm glad you're getting the hang of the game. Thanks for the pull request - I've merged it. The squares thing is now fixed as well - it must have changed during my edits earlier. Seems to working fine now.Thanks again!
-
@chriswilson Oh, one other thing: Are you on Twitter? I sometimes tweet about cool projects that are made with Pythonista, and I'd like to give proper credit (I'll just link to your GitHub otherwise). There is a chriswilson, but that doesn't seem to be you.
-
@omz Unfortunately I'm not on Twitter (yet). Feel free to link to my GitHub repo though. Thanks!
-
Oh and I should say thanks to @Cethric and @JonB who helped with some queries in this post last month.
-
@chriswilson Thanks, I've posted a little video (with custom color scheme).
-
@omz Thanks! I like the colours!
-
@chriswilson I just noticed a little bug: When you start the game while the device is in landscape mode, the layout isn't calculated correctly, because you're using
get_screen_size
, and the width/height are swapped in this situation. Could be fixed like this, for example:screen_w, screen_h = min(get_screen_size()), max(get_screen_size())
-
@omz Thanks. That fix works a treat! I'll commit it to GitHub shortly.
-
@omz @chriswilson A shorter solution is just to write
screen_w, screen_h = sorted(get_screen_size())
-
I've noticed that the timer does not always reset when closing the settings screen and I cannot figure out why! The
cancel()
andsave_settings()
functions both call thenew_game()
method, and a new grid is made, but sometimes the timer is part-way through its cycle. Any ideas?