Skip to content

shama/leveler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 * points)) / 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 ' + exp.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.

About

A streaming stat leveling API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published