Last active
December 6, 2016 12:07
-
-
Save AleBles/9ecafdb7b2df5006cc0fa8d97ccd9016 to your computer and use it in GitHub Desktop.
This file contains 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
class Pipe extends Phaser.Sprite { | |
public giveScore: boolean = true; | |
constructor(game: Phaser.Game, x: number, y: number, key: string) { | |
super(game, x, y, key); | |
this.game.physics.enable(this, Phaser.Physics.ARCADE); | |
this.body.velocity.x = speed; | |
} | |
public update(): void { | |
if(this.x+this.width<bird.x && this.giveScore){ | |
score+=0.5; | |
updateScore(); | |
this.giveScore = false; | |
} | |
if(this.x <= this.width) { | |
this.destroy(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment