pixijs.com
pixijs.com copied to clipboard
Issues with fish-pond tutorial
On step 2, "Adding a Background", the instructions are missing the vital step of adding
// Add the background to the stage.
app.stage.addChild(background);
This causes the background not to be added to the canvas.
On step 4, "Adding Water Overlay", the last set of instructions say to add this code:
elapsed += time.deltaTime;
overlay.tilePosition.x = elapsed * -1;
overlay.tilePosition.y = elapsed * -1;
which does not work. First, elapsed is not defined anywhere, and the addition assignment operator throws an error.
The code from the "solution" button is as follows:
// Extract the delta time from the Ticker object.
const delta = time.deltaTime;
// Animate the overlay.
overlay.tilePosition.x -= delta;
overlay.tilePosition.y -= delta;