39 lines
954 B
JavaScript
39 lines
954 B
JavaScript
const Phaser = require('phaser');
|
|
|
|
const CrypList = require('./cryp.list');
|
|
const Menu = require('./menu');
|
|
// const Passives = require('./passives');
|
|
|
|
function renderCryps(store) {
|
|
const config = {
|
|
type: Phaser.AUTO,
|
|
// parent: 'cryps',
|
|
backgroundColor: '#181818',
|
|
resolution: window.devicePixelRatio,
|
|
width: window.innerWidth,
|
|
height: window.innerHeight,
|
|
physics: {
|
|
default: 'arcade',
|
|
arcade: {
|
|
debug: false,
|
|
gravity: { y: 0 },
|
|
},
|
|
},
|
|
scene: [
|
|
Menu,
|
|
CrypList,
|
|
],
|
|
};
|
|
|
|
const game = new Phaser.Game(config);
|
|
|
|
store.subscribe(() => {
|
|
const state = store.getState();
|
|
game.registry.set('cryps', state.cryps);
|
|
});
|
|
|
|
window.addEventListener('resize', () => game.resize(window.innerWidth, window.innerHeight), false);
|
|
}
|
|
|
|
module.exports = renderCryps;
|