A couple of weeks back just prior to the Easter weekend Euro RSCG launched another campaign for the Australian Democrats. Called “Easter Egg a Bastard” – pick a politician’s website, or enter your own URL and then egg the page.
I’m happy with the way I’ve seamlessly combined timeline animation with scripted animation. The bunny and egg are controlled using timeline animation right up until the egg hits the slingshot pouch. From then on it’s all ActionScript.
The timeline animation is triggered from ActionScript using good old gotoAndPlay(), and when each animation finishes, the bunny’s timeline calls stop() and then broadcasts an event back out to the view class controlling the bunny. The bunny SWF is embedded at compile time which would normally cause any ActionScript to be stripped out, so I used this method of preserving timeline code in embedded assets. Read the comment on that post though – I also found that waiting one frame often wasn’t enough. I simply added a check for the existence of loader.content in the enterFrame handler before continuing.
I also love the feel of the slingshot physics – it took a fair bit of tweaking to get right. The feeling of depth as you pull back on the slingshot is faked. No Z dimension – the pouch & egg are just scaling based on their Y position. This meant that I didn’t need to do any converting back and forth between 3D and 2D coordinates to draw the rubber strips. Once the egg leaves the slingshot however, proper 3D takes over and the egg is positioned & scaled based on its Z coordinate. When budget or schedule (or both!) are tight, it’s essential to keep things simple and not over-engineer.