Quantcast
Channel: Oracle Bloggers
Viewing all articles
Browse latest Browse all 19780

Phaser and NetBeans IDE (Part 2)

$
0
0

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


Viewing all articles
Browse latest Browse all 19780

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>