-
Notifications
You must be signed in to change notification settings - Fork 6
aron edited this page Sep 8, 2011
·
18 revisions
This the global object (it stands for JavaScript Jungle) this is where the jungle environment is controlled. You can use it to get the size of the jungle, listen to global events or even fire your own.
This is the main method you'll use to create new creatures. A creature is just a layer (
) in the jungle.
name - A name for your creature, it needs to be unique to the jungle.
func - A function that will be passed your creature object to work on.
jj.createCreature('billy', function (creature) {
// Give your creature a size.
creature.size({width: 50, height: 50});
// Center your creature in the world.
var worldCenter = jj.center();
creature.position({
top: worldCenter.top - 25,
left: worldCenter.left - 25
});
});