leveler

0.1.0 • Public • Published

leveler

A streaming stat leveling API.

example

var leveler = require('leveler')

// Create a leveling thing
var exp = leveler(function(points) {
  return Math.floor(Math.floor(25 + Math.sqrt(625 + 100 * x)) / 50)

  // or if you need async emit 'levelup' and return false
  // exp.emit('levelup', level)
  // return false
})

// Every second add 100 experience points
setInterval(function() {
  exp.write(100)
}, 1000)

exp.on('data', function(level) {
  console.log('Player has reached level ' + level + ' with ' + this.points + ' exp!')
})

install

With npm do:

npm install leveler

Use browserify to require('leveler').

release history

  • 0.1.0 - initial release

license

Copyright (c) 2013 Kyle Robinson Young
Licensed under the MIT license.

Readme

Keywords

none

Package Sidebar

Install

npm i leveler

Weekly Downloads

0

Version

0.1.0

License

none

Last publish

Collaborators

  • shama