Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. class Pipe extends Phaser.Sprite {
  2. constructor(game: Phaser.Game, x: number, y: number, key: string) {
  3. super(game, x, y, key);
  4.  
  5. this.game.physics.enable(this, Phaser.Physics.ARCADE);
  6. this.body.velocity.x = speed;
  7. this.giveScore = true;
  8. }
  9.  
  10. public update(): void {
  11. if(this.x+this.width<bird.x && this.giveScore){
  12. score+=0.5;
  13. updateScore();
  14. this.giveScore = false;
  15. }
  16. if(this.x <= this.width) {
  17. this.destroy();
  18. }
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement