phaserjs / phaserjs/phaser

docs.phaser.io example causes `Uncaught TypeError`

Open
#7,132 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
40.3k
Forks
7.2k
PR merge metrics
No merged PRs in 30d

Description

https://docs.phaser.io/phaser/concepts/gameobjects/image#custom-class

Hello.

Example shows:

this.add.existing(this);

Descriptions about this line says Adds an existing Game Object to this Scene

this is the current instance of the class Phaser.GameObjects.Image

So there should be:

scene.add.existing(this);

Where scene is constructor argument.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open the linked custom-class example in the Phaser documentation and inspect the line that calls this.add.existing(this). Update the example to use the constructor's scene argument, then verify that the example no longer causes the reported Uncaught TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.