For fun I’ve reproduced the classic game Asteroids. It’s going well so far. I am to the point where a flying saucer can relatively accurately hit the ship if it’s traveling on a constant heading.
Now I need to figure out how to introduce the saucer. In the real game, the small asteroid is quite adept at moving through the field of asteroids, which is presumably because the program checks each asteroid’s trajectory and calculates a path through it. Kind of like the Millenium Falcon in Episode IV.
Does anyone have any ideas for how to calculate a “safe path” through a set of moving asteroids? What we know about each asteroid is its speed and direction. I’m guessing that a function fired repeatedly by an ENTER_FRAME handler, to update that path (the saucer can change direction) would have to be quite economical in order to save CPU.