Bold Pixel Engine v0.9 refactor
Hi everyone!
As promised, as soon as BPE has a couple of games under its belt, it will be made available. There are a couple of games going on with it and those are almost done, but the engine’s part is finished.
With all we’ve been through with it, refactoring was needed so I put a bit of work in the engine this evening (coding on a Saturday evening… geek!) and I’d like to show you how to do something with it.
I’d love that you take a look at the code and let me know if you think it is easy to follow, since this is the philosophy behind most of BPE’s classes.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
package
{
import bpe.blit.*;
import bpe.managers.*;
import flash.display.MovieClip;
import flash.events.Event;
public class BoldPixelEngine extends MovieClip
{
public function BoldPixelEngine():void
{
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event)
{
var engine:Engine = new Engine(640, 480);
var layer:Layer = engine.layer.create();
var actor:Entity = layer.entity.create();
var animation:uint = TextureManager.createCollectionFromMovieClip(idle);
addChild(engine.render.window);
actor.x = 320;
actor.y = 140;
actor.animation.loop(animation);
Loop.AddListener(engine.update);
}
}
} |
What this code does is to create a blit engine instance in the stage and draw a time based animation in it.
What I’d like to know is, without any further explaining, does this look simple and intuitive to you?
Thanks!
Posted: January 30th, 2010
at 11:52pm by Vlad
Tagged with Bold Pixel Engine, FlashGameBlogs
Categories: The code of VGS
Comments: 9 comments
