Friday, November 4, 2011

Merging Ideas

Over the last few weeks I have been finding time to program again, with a focus on my Mario World game...  Or more specifically, the World Builder for this game, which I will soon be using for my unnamed RPG project, WORG, as well.  Hence why I am back at the blog!  I will have a video overview and some information on the blog coming soon about the new world builder.


This character sprite sheet is automatically chopped up so
the characters are instantly playable using the
'characterVisual' class.
This post will be deticated to the new character importing system.  As you can see in the picture to the right, I have many sheets with characters like these ones to be imported into the game.  I wanted to create an easy way to get a lot of characters into the game quickly, and thats when I created my CharacterVisual class, or 'sheet sprite' system.  What it does is it takes sheets like this one and chops them up automatically into characters so that I do not have to do it manually in flash.


This will make it easier for players to create custom characters and NPCs in the future.  I think I will keep the ability to upload these sheets as administrative-only though, for quality control.


Below is the function that I found online which makes it very easy to extract individual frames from this larger image.
private function cropBitmapData(sourceBitmapData:BitmapData, startPoint:Point, width:Number, height:Number):BitmapData {   var croppedBD:BitmapData = new BitmapData(width, height);   croppedBD.copyPixels(sourceBitmapData, new Rectangle(startPoint.x, startPoint.y, width, height), new Point(0, 0));   return croppedBD.clone();   croppedBD.dispose();}

You can read about it more on this webpage.  This method of importing characters makes importing new characters easy and is vastly superior to my old method of having a 'character' movieclip, and placing each character on a different frame of this movieclip, then in a movieclip within that movieclip having different frames for the different walking animations.  Not only is this new method less resource intensive, it will be much easier to import characters.   I have already imported over 100 characters, and have spent maybe 1/20th of the time doing it as I did in my Chip N Dales MMORPG game!!!


Lss