Just wanted to share my game but also wanted to highlight pyxel as a python game library. If you haven't heard of it, it's a really cool, easy to use retro game library.
If you have heard of it but haven't checked it out for a while, have another look. Kitao has been absolutely slaying it, and pyxel now has a really nice editing tool that covers images, tiles, sounds, and music. It also has some stubs and type annotations so everything works smoothly with your IDE.
Just curious on how long it would take the average person to make a simple game like snake or the dinasour running e.t.c. how long did it take you to make this?
This asteroids game probably took me 5-7 hours? Hard to track as I chip at it half an hour at a time. There’s a bit more time lying in bed thinking of how I’m going to implement the next bit.
I'm not sure if there's an event loop or something like that with the pyxel library they're using, but the approach I would take: check the bounding boxes between the game area, asteroids, and the player with each frame; you'd be checking for overlapping coordinates.
For this game I used a super simple method of collision detection assuming each object is a circle. Then you just compare the distance between the two objects (using the hypotenuse) to the combination of the two radiuses.
Not perfect but works well enough. Sometimes the tip of the ship can pass through an asteroid without dying.
Oh and pyxel totally has an event loop with two end points accessible to the user: an update function for game state and a display function for rendering - this allows it to skip frames if necessary.
28
u/timbledum Jan 20 '19 edited Jan 20 '19
Hey all! Game here.
Just wanted to share my game but also wanted to highlight pyxel as a python game library. If you haven't heard of it, it's a really cool, easy to use retro game library.
If you have heard of it but haven't checked it out for a while, have another look. Kitao has been absolutely slaying it, and pyxel now has a really nice editing tool that covers images, tiles, sounds, and music. It also has some stubs and type annotations so everything works smoothly with your IDE.
There are a bunch of user made games listed here.