Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/excaliburjs/sample-excalibird. Getting started example clone of Flappy Bird excaliburjs.com/sample-excalibird
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031import * as ex from "excalibur";import { Level } from "./level";import { Config } from "./config";import { Resources } from "./resources";import { Bird } from "./bird";
export class ScoreTrigger extends ex.Actor { constructor(pos: ex.Vector, private level: Level) { super({ pos, width: 32, height: Config.PipeGap, anchor: ex.vec(0, 0), // color: ex.Color.Violet, vel: ex.vec(-Config.PipeSpeed, 0) })
this.on('exitviewport', () => { this.kill(); }); }
override onCollisionStart(_self: ex.Collider, other: ex.Collider): void { if (other.owner instanceof Bird) { this.level.incrementScore(); Resources.ScoreSound.play(); } }}