X

Geertjan's Blog

  • January 5, 2014

Phaser and NetBeans IDE (Part 2)

Geertjan Wielenga
Product Manager

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:

http://www.youtube.com/watch?v=WXKh6UcoKhU

http://www.youtube.com/watch?v=3Ju-p1xaFn8

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
Oracle

Integrated Cloud Applications & Platform Services