Dec 15

#Phaser.io phaser-swipe-pages

Find it on GitHub

Phaser component to manage a state of pages

Can be useful for eg help screens etc. It will use the Phaser.Camera to move around, and take care of
positioning your objects


The easies way of using it is compiling your project with browserify and install it like:

  npm install phaser-swipe-pages


    var SwipePages = require('phaser-swipe-pages');
    // in create
    this.pages = new SwipePages(this.game, 3);
    // If you want standard menus. Else you can create your own and pages.addToStationary(obj);
    this.pages.createMenu({}, this.back, this);
    // Create your pages. All objects should be created as positioned on the primary screen. The component will
    // move them to correct place
    var text = this.game.add.text(0,0,'page 1');
    this.pages.addToPage(1, text);
    // Here we add a text to page 2. But the positioning is still 0,0
    var text2 = this.game.add.text(0,0,'page 2');
    this.pages.addToPage(2, text2);
    // Go to page 1
    this.back = function() {
      // This.will be called when the user presses SKIP on the menu
Jun 15

#nodejs module for parsing key/value strings

Since my regexp test on parsing a string was a success, I created a #nodejs module for parsing strings. And the funny part, I scrapped the regexp 🙂 It now supports multiple keys and multiple values.

So you can do something like this:

var res = ps.parse('"foo bar" bar,"foo bar"=1 bar,"foo bar"=bar,"foo bar"');
res = [
   ['foo bar', undefined],
   ['bar', '1'],
   ['foo bar', '1'],
   ['bar', ['bar', 'foo bar']],
   ['foo bar', ['bar', 'foo bar']]

You can find the code at GitHub or as a npm module