In this tutorial you’re going to find out how to make
pixi.jsgame with v5, how to utilize the latestesfeature, how to separate.jsfiles(es module), how to load resource, how to fit the screen automatically, how to playsoundandvideo, how to splitlayer, how toextends pixi class,how to makeinternationalization, how to usewebpackandbabelto develop and distribute the game(optimize the image files, tree shake/combine/convert/obfuscate thejsfiles) and so on.The source code is well commented, hope you can enjoy it. you can learn more about webpack in detail in this projectpixi-webpack-demo
- you should have
nodejsinstalled. - run
npm installcommand to install the dependencies. - run
npm startcommand to start the project, it will open chrome browser automically.
- based on pixi.js version 5.2.
- use
webpackto debug the project at development phase, and combine, convert(to es5) and obfuscatejsfiles at distribution phase. - the code is written in es8 and use
babelto convertes6+toes5. - use
texturepackertool to create atlas. - basic
cssandhtmlknowledge, thecanvaswill auto fit the screen when viewport changed.
res:texturepackerproject and original font files etc.src:all game resource and source code.dist: distribute the final game project here.webpack.common.js: webpack common configuration file.webpack.dev.js: webpack configuration file for development.webpack.prod.js: webpack configuration file for produciton.package.json:nodeconfiguration file.
- run
npm run buildcommand toreleasethe project, all the files will copy intodistdirectory, all.jsfiles will combined、converted toes5and obfuscated, all png files will be optimized.