This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Full tutorial: http://codevinsky.ghost.io/phaser-2-0-tutorial-flappy-bird-part-2/ */ | |
'use strict'; | |
var Bird = function(game, x, y, frame) { | |
Phaser.Sprite.call(this, game, x, y, 'bird', frame); | |
this.anchor.setTo(0.5, 0.5); | |
// add flap animation and begin playing it | |
this.animations.add('flap'); | |
this.animations.play('flap', 12, true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Full tutorial: http://codevinsky.ghost.io/phaser-2-0-tutorial-flappy-bird-part-3/ */ | |
'use strict'; | |
var Bird = function(game, x, y, frame) { | |
Phaser.Sprite.call(this, game, x, y, 'bird', frame); | |
this.anchor.setTo(0.5, 0.5); | |
this.animations.add('flap'); | |
this.animations.play('flap', 12, true); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Full tutorial: http://codevinsky.ghost.io/phaser-2-0-tutorial-flappy-bird-part-4/ */ | |
'use strict'; | |
var Pipe = function(game, x, y, frame) { | |
Phaser.Sprite.call(this, game, x, y, 'pipe', frame); | |
this.anchor.setTo(0.5, 0.5); | |
this.game.physics.arcade.enableBody(this); | |
this.body.allowGravity = false; | |
this.body.immovable = true; |