MCPcopy
hub / github.com/ssusnic/Machine-Learning-Flappy-Bird / Bird

Function Bird

source/gameplay.js:360–373  ·  view source on GitHub ↗
(game, x, y, index)

Source from the content-addressed store, hash-verified

358/***********************************************************************************/
359
360var Bird = function(game, x, y, index) {
361 Phaser.Sprite.call(this, game, x, y, 'imgBird');
362
363 this.index = index;
364 this.anchor.setTo(0.5);
365
366 // add flap animation and start to play it
367 var i=index*2;
368 this.animations.add('flap', [i, i+1]);
369 this.animations.play('flap', 8, true);
370
371 // enable physics on the bird
372 this.game.physics.arcade.enableBody(this);
373};
374
375Bird.prototype = Object.create(Phaser.Sprite.prototype);
376Bird.prototype.constructor = Bird;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected