leveler

A streaming stat leveling API.

npm install leveler
2 downloads in the last week
4 downloads in the last month

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.

npm loves you