PBE Series: quickly displaying sprites via ActionScript

December 16th, 2009 by Christian Leave a reply »

Prerequisites:

There’s not much to say. We’ll just create an entity with a sprite render component – and position it in our scene.

//Create a new entity:
var myEntity:IEntity = PBE.allocateEntity();
myEntity.initialize("MyEntity");
 
//Render component:
var renderComp:SpriteRenderer = new SpriteRenderer(); 
 
renderComp.scene = PBE.getScene();
renderComp.fileName = "../assets/Images/platform.png";
renderComp.position = new Point(0, 0);
renderComp.rotation = 0.0;
 
//Add the component to the entity:
myEntity.addComponent( renderComp, "Render" );

That’s the comfortable thing when working with PushButton Engine! You don’t necessary need a spatial component or such, just to display graphics. In case you wonder what a spatial component is: they’ll be covered in the next PBE Series tutorial!

2 comments

Leave a Reply