simple assets loader for images
npm install @robotopia/assets-loader
Initially load all your images
const assets = require('@robotopia/assets-loader')
assets.load({
HERO: 'path/to/hero.png',
WATER_TILE: 'path/to/water-tile.png',
})
.then(() => {
// start application
})
.catch(() => console.log('error loading assets'))
After all images have been loaded they can be accessed by their name
assets.store.HERO // reference to hero.png