HTML 5 Games With Lime JS, Part 1: The Start Method

To begin our test game, let’s take a look at the core objects that are defined within a Lime JS game.  Every app has a start function that is the main entry point for the application, which  gets called when the body of the document loads.  Within this method are a few common startup statements to initialize the application:

test.start = function(){
var director = new lime.Director(document.body,1024,768),
scene = new lime.Scene(),
target = new lime.Layer().setPosition(100,100);


At the beginning, we create a new director object.  The director has many responsibilities;  for example, it manages the current viewport (which element it’s defined in and its size) and defines which  scene is displayed to the user, represented by the lime.Scene class.  Scenes are a container that’s rendered to the view, which contains one or many drawable objects that are appended to it.  Typically, a layer represents a set of drawable objects, similar to how a layer is defined in Photoshop.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s