Lucy forge
Part of lucidity project.
Beta software. Until 1.0, API subject to change.
Entity and component definition tool
lucy.forge is a minimal 'game' or 'feature composition' engine. It's goal is to
foster clean and reusable Javascript code through the extensive use of mixins
and conventions.
Installation
npm install lucy-forge --save
Usage example:
const forge = require ( 'lucy-forge' )
const Person = forge.Component
( 'Person'
, {
setup ( e )
{ e._person = {}
Person.people.push ( e )
e.bind
( 'destroy'
, function ()
{ Person.peopleCount --
}
)
}
, init ()
{ this.peopleCount = 0
}
, count ()
{ return this.peopleCount
}
}
, { person ( name, age )
{ let self = this._person
self.name = name
self.age = age
}
}
)
let Person = forge.findComponent ( 'Person' )
console.log
( Person.count () )
let player1 = forge.Entity
( 'Person'
, 'Score'
, { person: [ 'John Difool', 34 ]
, score: 100
}
)
console.log
( Person.count () )
Tests
make
Contributing
Please use 'jessy style'.
Add unit tests for any new or changed functionality.
Release History
- 0.5.0 (2015-09-22) Better #set method, forge.merge.
- 0.4.0 (2015-09-09) Renaming init to 'setup'. Init is now called on class.
- 0.3.0 (2015-09-04) API change for forge.Component with class methods.
- 0.2.0 (2015-09-03) Adding possibility to replace binding.
- 0.1.0 (2015-09-02) Initial release.