September 30, 2007
Next Flash game underway
The next game in ActionScript 3.0 Game Programming University is a shooting game called “Air Raid”, where you move a cannon from left to right to shoot down aircraft. However I’ve decided I’d prefer to branch out a little and make something else up vaguely in the same area. I settled on an old school style arcade scrolling shooter along the lines of Galaxian or Galaga. I figure it’s time to start to learn from trial and error by making more of the decisions on the program structure and programming.
So far all I’ve got is a few choice fonts (from Larabie Fonts like with the other games; Ray Larabie has brilliant free fonts for games) and a scrolling star field. The star field has taken me a little while to do. It’s got through a few iterations and I’m still not very happy with it. It’s a little bit jerky even though I’m using time based movement, and I don’t know whether that’s a limitation of Flash or I’m doing something wrong.
My first approach to the star field was to have an array of star sprites that move down the screen. My second approach was to draw the stars individually onto a single star field sprite every frame. I actually tried both approaches at the same time as I wasn’t sure which would be best. I found that there didn’t seem to be much of a difference between the two - they both were okay, but they both stuttered in movement.
My next approach was to render all the stars at creation to sprite layers saved as bitmaps, and to scroll the layers down the screen. I used two identical sprites per layer so I could have them seamlessly wrap from top to bottom. There were some weird motion effects on the two sprites where they weren’t moving at quite the same speed, which I suspect was due to floating point errors. I’ve now got them working on a variant of fixed point and got both sprites moving in lock step, but there’s still a bit of animation stutter.
I might be overreacting since it isn’t that bad, but I’m curious as to whether there’s a way to getting the scrolling silky smooth in Flash. For now it’s good enough, and I’ll move onto planning out the game.
Additional: I’ve just noticed that the PNG screenshot of the Flash file is several times larger than the Flash file itself. I might as well just post the whole darn thing instead of a still picture!
The thumbnail link now goes to a copy of the Flash file. It might be nice to have a couple of copies of works in development to compare against.