Thursday, 14 June 2012

Thursday, 14 June 2012

Game Menus

Laying out menus with code just plain sucks. You shouldn't have to do it, period. If your approach is to use Flash to create/lay-out menus and then manually export all the assets as pngs, it's not going to be long before you start tearing out your hair.

The key problem is registration points and the co-ordinate system. In Flash 0,0 starts at the top-left, but on the iPhone 0,0 is bottom-left. That means that you can't just copy paste co-ordinates from one to the other. The second problem is the registration point. I can pretty much guarantee that at some point you'll export a graphic from Flash and find that the centered registration point in the graphic isn't in the same place in the PNG, or that top-left registration point is just slightly off because you stuck a drop shadow on something.

The hardcore solution is to programatically write a whole bunch of AS3 (approx 1,208 lines to be a little more precise). Now with a single click I can turn a complex Flash menu into a single file that I can load and run on my iPhone. Pure bliss.