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.
6
u/TheIncorrigible1 `__import__('rich').get_console().log(':100:')` Jan 20 '19
It's mostly collision detection and rendering that are the hard bits