Hauler v.005, and the Glory of callLater()

Here’s the latest iteration of Hauler. I worked on it all frickin’ weekend.

New Stuff

  • Overhauled combat system.  Still needs lots of work, but it’s a lot more fun than it was.
  • Models for several ships (including two that you won’t see yet!)
  • Explosions!
  • Character avatars for the pirates.  Nothing for the player to choose yet, however.
  • One-letter-at-a-time text with nifty sound.

The combat screen now has two modes – an “action” mode where you see the ships, lasers, explosions, etc. and then “dialog” mode, where it shows the pirate’s avatar a bit larger and they say stuff.  I got the ships and some temporary explosions, but no lasers yet.  I’m looking at some open-source Flash building tools to do the animations for lasers and explosions.

I used Second Life to build the ship models and character avatars.  As I’ve said before, I can’t draw, but I can bodge up models in SL pretty quick.  I just took some snapshots of the models/avatars and applied a Mosaic filter to get them all pixely.  Turned out pretty nice if I do say so myself.

Ship Models

Faux Millenium Falcon

Faux Millenium Falcon

Inspired by various Star Trek ships

Inspired by various Star Trek ships

NOO-B Class starter shuttle

NOO-B Class starter shuttle

Juggernaut - huge and bristling with guns!

Juggernaut - huge and bristling with guns!

A large, sturdy cargo ship

A large, sturdy cargo ship

The large cargo ship and Juggernaut are not yet seen in the game.  One of my next steps is to add the ability for the player to purchase new ships.  I also need to develop a system that pits you against pirate ships of similar firepower/size.

Technical Notes

I was having a dickens of a time trying to debug a sequence wherein the player loses a battle.  At the end of the fight, the pirate talks some smack, then it shows the player (eventually I hope to have a dejected-looking expression on the avatars)  and explains the consequences of their defeat.  During that change from pirate dialog to player dialog, it kept locking up.

I have a new rule when developing in Flex, and it serves me well:  Whenever you spend more than 10 minutes trying to debug a weird problem in Flex, it’s probably a creation timing issue.  Turns out that’s exactly what it was.  I was wiping out the character component’s text box before printing new dialog, and since the component wasn’t finished building itself on the screen yet it freaked out.  I solved it by wrapping the function call with a callLater( ) and bam…works great.

In case you’re wondering, callLater(function_name, [array of arguments]) is a great little function that makes Flash wait until all of the declared components have been placed on the stage, then it calls the function you put in as an argument.  It’s like telling Flash “Hey, do what you need to do to get yourself ready.  When you’re done, do this thing.”

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: