Skip to content

Commit

Permalink
add timer
Browse files Browse the repository at this point in the history
  • Loading branch information
eonarheim committed Jan 17, 2025
1 parent 459206a commit 22c9e09
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/level.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Color, DefaultLoader, Engine, ExcaliburGraphicsContext, Random, Scene, SceneActivationContext, vec } from "excalibur";
import { Color, DefaultLoader, Engine, ExcaliburGraphicsContext, Random, Scene, SceneActivationContext, Timer, vec } from "excalibur";
import { Firework } from "./firework";

export class MyLevel extends Scene {
timer!: Timer;
constructor() {
super();
this.backgroundColor = Color.Black;
Expand All @@ -23,6 +24,14 @@ export class MyLevel extends Scene {

this.input.pointers.on('down', launch);
this.input.keyboard.on('press', launch);

this.timer = new Timer({
fcn: launch,
interval: 1000,
repeats: true
});
this.timer.start();
this.add(this.timer);
}

override onPreLoad(loader: DefaultLoader): void {
Expand Down

0 comments on commit 22c9e09

Please sign in to comment.