More fun with Phaser.
And here's the code:
var game = new Phaser.Game(800, 270, Phaser.AUTO, '', {preload: preload, create: create, update: update}); function preload() { game.load.image('sky', 'assets/sky.png'); game.load.spritesheet('cat', 'assets/runningcat.png', 512, 256, 8); } function create() { game.add.sprite(0, 0, 'sky'); player = game.add.sprite(40, 0, 'cat'); cursors = game.input.keyboard.createCursorKeys(); player.animations.add('run'); player.animations.add('walk'); player.animations.play('walk', 5, true); } function update() { if (cursors.right.isDown) { player.animations.play('run', 70, false); } else { player.animations.play('walk', 5, true); } }
Two (silent) YouTube movies with NetBeans and Phaser: