Well, I spent quite a bit of time working on the sprite for Saint Peter. My original intention, as mentioned in the last post, was to simply draw over a professionally used bitmap sprite. But that turned out to be too much of a hassle, and it turns out I actually kinda enjoyed myself creating the thing. The body still needs some work, but I kind of like the bobble-head look it's got right now.
Part of the reason why this post is two weeks after the last one is that I won't be able to use the school's lab anymore, so that means I don't have access to the Flash IDE. This turned out to be a good thing, as it's forced me to learn how to work using FlashDevelop.
Still, my original sprite was created in illustrator and saved as SVG's. AS3 has some built in asset loading features of course, but as far as loading vector graphics directly on the stage, it can only handle SWF files. After a little research, I found that Lucas Lorentz has been heading up a project called as3svgRenderLib. It's basically a class that lets you load SVG data as XML and it renders it and spits it out as a Sprite that you can attach to the stage. Pretty cool stuff!
Give it a try if you want.
- Grab everything that you find in the "com" directory here and save it in the same directory as your main AS3 file (preserve the paths, so it's com/lorentz/SVG.)
- Put a sample SVG file in the same directory where your SWF file is generated (if you're using FlashDevelop, put it in the "bin" directory" of your project
- Make sure you're using version 10 of the flash player. If you're using Falshdevelop, go to the Project menu, then Properties, and on the Output tab change the Platform to Flash Player 10.
- I always like to strip down examples to their most basic. The example that came with svgRenderLib does some extra stuff, so I simplified it. You can use this simplified script as your Main AS3. Change the name of the SVG file it's looking for, then you can run it, and you should see the sample SVG displayed on the screen.
So, next on the Leap of Faith project, I'm going to figure out how to best animate the sprite. I want it to have different facial expressions for when it's doing well, as opposed to when it's about to sink in the water, so I think I'm going to import the facial features separately and then write a class to control how the head is animated. We'll see. I'm just glad I can move forward again.