Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Pipe extends Phaser.Sprite {
- 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;
- this.giveScore = true;
- }
- 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();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement