kittykatattack / learningPixi

A step-by-step introduction to making games and interactive media with the Pixi.js rendering engine.
4.4k stars 851 forks source link

When combined with ionic3,PIXI.loader is undefined,I don't know what happened #130

Open hjg0422 opened 5 years ago

hjg0422 commented 5 years ago

...

jlapointe commented 5 years ago

I recently encountered this too. It's because Pixi v5 changes the structure a little. (It looks like this tutorial is a bit out of date!)

Instead of using PIXI.loader, we should now use the loader property attached to the Application object we create. Like so:

let pixiApp = new PIXI.Application({ /* settings */});
// PIXI.loader.add(/* filename */).load(/* some function */);   <--- old syntax
pixiApp.loader.add(/* filename */).load(/* some function */);   <--- new syntax

http://pixijs.download/release/docs/PIXI.Application.html