Skip to content

Instantly share code, notes, and snippets.

View bladnman's full-sized avatar

Matt Maher bladnman

View GitHub Profile
@bladnman
bladnman / menu.js
Created September 27, 2015 14:44 — forked from ada-lovecraft/menu.js
Phaser 2.0 Tutorial: Flappy Bird (Part 1) : Full tutorial: http://codevinsky.ghost.io/phaser-2-0-tutorial-flappy-bird-part-1/
/* Full tutorial: http://codevinsky.ghost.io/phaser-2-0-tutorial-flappy-bird-part-1/ */
'use strict';
function Menu() {}
Menu.prototype = {
preload: function() {
},
create: function() {
// add the background sprite
@bladnman
bladnman / Bird.js
Created September 27, 2015 14:44 — forked from ada-lovecraft/Bird.js
Phaser 2.0 Tutorial: Flappy Bird (Part 2) : Full tutorial: http://codevinsky.ghost.io/phaser-2-0-tutorial-flappy-bird-part-2/
/* 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);
@bladnman
bladnman / Bird.js
Created September 27, 2015 14:44 — forked from ada-lovecraft/Bird.js
Phaser 2.0 Tutorial: Flappy Bird (Part 3) :: Full tutorial: http://codevinsky.ghost.io/phaser-2-0-tutorial-flappy-bird-part-3/
/* 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);
@bladnman
bladnman / pipe.js
Created September 27, 2015 14:44 — forked from ada-lovecraft/pipe.js
Phaser 2.0 Tutorial: Flappy Bird (Part 4) :: Full tutorial: http://codevinsky.ghost.io/phaser-2-0-tutorial-flappy-bird-part-4/
/* 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;