Popular contentToday's:All time:NavigationUser login |
experimentsPapervision Sprite ExtruderI wanted to have a play with creating programmatic models in Papervision 3D. My Flash 9 demo takes as input a transparent GIF OR PNG, and parses through this file, creating a 3D cube, for each pixel, which i can then fully control, in this case I slowly explode the sprite. Theres a few Sprites in there - just hit refresh to see a different one. An evening alone with AS3 after [fotb]After coming back from flash on the beach and listening to Brandon Hall, and Keith Peters great sessions on AS3, I've been quite eager to have a play around. Personally I always find the best way to learn any new language is to make a game, and I thought my blog could also do with a little more colour, so i downloaded the FLEX 2 Beta from Adobe labs and got cracking. I wanted to make something which used the new AS3 specific features, but also some of the Flash 8 features, such as bitmaps and filters, which I have dabbled with only briefly. I while ago a made a nice little demo with some circle things that build doozer constructions into the sky, this had always suffered from a bit of slowdown once i got to a certain amount of onscreen content so I figured this would be a good base for conversion. Im also pretty excited by what Nintendo are doing with the Wii, so though i could ditch my yellow circle creatures, and paste a little homage to Mario in there. Each mario is a movieclip, this allowed me to import a animated GIF directly. To get him facing left, i just set scaleX to -1 (remembering scale has change to 0-1 for 0-100%) When you click on a character, I create several Bitmap instances, and again use the copyPixels command to create the animated exploding tiles. This time a drop shadow filter is applied to give the 2.5D effect. You can see the finished thing in banner form, on the blog http://www.freesome.com, for the banner version I use the stage.StageHeight property to detect Im in banner mode, then disable the theme tune playback until mouse over. In full screen mode, you can resize the window and refresh to make the movie fit the window. Not really a game as such, see how long you can stop them reaching the top of the screen - but i find it oddly enjoyable... I guess you just dont get enough chance to shoot Mario normally :) What did i enjoy about AS3? I love the eclipse based Flex environment. The code completion is, if anything, even better than FlashDevelop, an especially cool feature is the automatic adding of import statements. Its also a Mac native application, where as FlashDevelop is .NET only. The speed is cool - I've tested with 1000 of the little critters on screen and still found very little slowdown. Looking at some of the papervision 3D AS3 demos that are circulating on the beta list, i think we've about reached the level Atari ST/ Commodore Amiga power now.. . exciting. There isn't so much to learn. Introducing AS2 when they did was a good move by Macromedia - even if it did not change the underlying architecture it gave us lots of time to practice with the typing variables and so on. If you've been doing this for a while now, and it really does make your life simpler so there no reason not to, most of the transition work is no hassle for you. All the new import statements and re-jigging of classes and properties will take a little while, but its not so bad. For example it took me quite a while to figure out how to change the mouse pointer to a pointing hand (its DisplayObject.buttonMode = true by the way). A couple of things I found i was a little unsure which related to AS3. Different types of displayObject. We have, MovieClip, Sprite, and Bitmap classes. I'm still not one confident when to use one over the other, i'm sure i could optimize better if i did. Garbage collection. Grant Skinners articles on this subject has made me sure this is going to be a problem for many. I definitely found some some slowdown if I've got lots of exploding objects on screen. Im not sure, but this may be related to how i remove the parent objects. I need to have another read of Grants articles i think :( I found the way to load things like sound a little long winded, you need three separate classes to load a sound which seems a little excessive.. but I guess once I get all this functionality into a class of its own it will be simple, but yeah, a quick and dirty loadSound - takes six lines of code now... You can find the source here. |