Skip to content

mzgoddard/aquajs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AquaJS

Aqua wants to provide rudimentary code for developing games in JavaScript. It isn't an engine but it provides work to help produce one.

Requires

For building:

- grunt
- uglifyjs

Examples

A Game

var myGame = aqua.game(),
    myEntity = aqua.entity();

// setup rendering, physics, etc services
myGame.addService(someService());
...

// its a good idea to have a component type for storing position, rotation, and other location in world state
var transformComponent = function() {
  aqua.base(this).constructor.call(this);

  this.position = vector(0, 0);
};
transformComponent = aqua.extend(
  aqua.component(),
  {
    // transform methods
  });

myEntity.add(transformComponent());
myEntity.add(renderingComponent());
myEntity.add(...);
myGame.add(myEntity);

myGame.main();

Service

This is an example service that replicates the tasks Game objects has by default.

var UpdateService = function() {
  aqua.base(this).constructor.call(this);
};

UpdateService.prototype = aqua.extend(
  aqua.service(),
  {
    ongameadd: function(game) {
      this.tasks.push(
        game.task({callback: game.call.bind(game, 'update')}));
      this.tasks.push(
        game.task({
          callback: game.call.bind(game, 'lateUpdate'),
          priority: 'LATE_UPDATE'}));
    }
  }
);

About

Basic bits for JS Game Dev

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%