From 75235d38591e5e24acbb0e352cc1c67390d9c202 Mon Sep 17 00:00:00 2001 From: Erik Onarheim Date: Wed, 1 Jan 2025 18:22:04 -0600 Subject: [PATCH] docs: Adjust Bird constructor --- site/docs/00-tutorial/08-step-periodic-pipes.mdx | 2 +- site/docs/00-tutorial/09-step-scoring-points.mdx | 4 ++-- site/docs/00-tutorial/10-step-game-over.mdx | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/site/docs/00-tutorial/08-step-periodic-pipes.mdx b/site/docs/00-tutorial/08-step-periodic-pipes.mdx index a59940aa9..103f7872e 100644 --- a/site/docs/00-tutorial/08-step-periodic-pipes.mdx +++ b/site/docs/00-tutorial/08-step-periodic-pipes.mdx @@ -104,7 +104,7 @@ import { PipeFactory } from './pipe-factory'; export class Level extends ex.Scene { random = new ex.Random(); pipeFactory = new PipeFactory(this, this.random, Config.PipeInterval); - bird = new Bird(this); + bird = new Bird(); ground!: Ground; onInitialize(engine: ex.Engine): void { diff --git a/site/docs/00-tutorial/09-step-scoring-points.mdx b/site/docs/00-tutorial/09-step-scoring-points.mdx index 529736198..ffe0a5c82 100644 --- a/site/docs/00-tutorial/09-step-scoring-points.mdx +++ b/site/docs/00-tutorial/09-step-scoring-points.mdx @@ -149,7 +149,7 @@ You might notice that sometimes the score double counts sometimes! Well this is export class Bird extends ex.Actor { ... - constructor(private level: Level) { + constructor() { super({ pos: Config.BirdStartPos, // width: 16, @@ -161,4 +161,4 @@ export class Bird extends ex.Actor { ... } -``` \ No newline at end of file +``` diff --git a/site/docs/00-tutorial/10-step-game-over.mdx b/site/docs/00-tutorial/10-step-game-over.mdx index cb0ffe2fa..8d654926c 100644 --- a/site/docs/00-tutorial/10-step-game-over.mdx +++ b/site/docs/00-tutorial/10-step-game-over.mdx @@ -63,12 +63,13 @@ export class Level extends ex.Scene { } ``` -In our `Bird` we want to trigger this game over when it leaves the screen and when it collides with a `Pipe` or the `Ground` +In our `Bird` we want to trigger this game over when it leaves the screen and when it collides with a `Pipe` or the `Ground`, so we'll pass in the instance of the `Level` so we can call it's `triggerGameOver()`. ```typescript // bird.ts export class Bird extends ex.Actor { playing = false; + constructor(private level: Level) { ... } ... override onInitialize(): void {