ND2Dx is a 2D GPU accelerated game engine. It is a big revision of the already existing ND2D engine, but with several changes. ND2Dx is based on a component entity system, where the common object (or entity) is Node2D
. It is a very basic object that acts like a DisplayObjectContainer
in flash. It has transformation properties (x
, y
, scaleX
, scaleY
), color properties (alpha
, tint
), can contain components and acts as a container for other Node2D
objects.
In order to show something, a rendering component is required. This rendering component is added to the node itself, making it able to appear on the screen. The built-in MeshRendererComponent
, which uses the same concept used by Unity game engine, can contain a Material
and a Mesh2D
object. The Material
object holds the texture and shader data. The Mesh2D
object holds the vertices that will make the triangles required to show something on screen.
Sample
public var world2D:World2D; public var gameScene:GameScene; public function Main() { addEventListener(Event.ADDED_TO_STAGE, onAddedToStageHandler); } private function onAddedToStageHandler(e:Event):void { removeEventListener(Event.ADDED_TO_STAGE, onAddedToStageHandler); // init our assets Assets.init(); // this is our main and primary object for ND2Dx, it automatically // configures itself to take the size and framerate of our document // you only need to create one world2D = new World2D(); // we need to add it to the stage in order for it to setup itself addChild(world2D); // a scene is necessary to start rendering anything it is a more // convenient way of managing different parts of our game // (main menu, secondary menus, game, other screens...) // as you can switch between them easily gameScene = new GameScene(); // set our scene as the active one world2D.setActiveScene(gameScene); // and start the rendering process world2D.start(); }
RT @as3gamegears: New: ND2Dx (2D GPU accelerated game engine) http://t.co/BO4cnAnCvA #as3 #flash #gamedev