Phaser and NetBeans IDE (Part 2)

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

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« July 2014
SunMonTueWedThuFriSat
  
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  
       
Today