Atlas and random aztec cryp loading
This commit is contained in:
@@ -127,8 +127,8 @@ class CrypImage extends Phaser.GameObjects.Image {
|
||||
} = crypAvatarText(team, iter);
|
||||
|
||||
// Cryp display
|
||||
const avatar = team ? 'magmar' : 'alk';
|
||||
super(scene, crypAvatarX, crypAvatarY, avatar);
|
||||
// const avatar = team ? 'magmar' : 'alk';
|
||||
super(scene, crypAvatarX, crypAvatarY, 'aztec', `sprite${Math.floor(Math.random() * 19) + 1}`);
|
||||
this.setScale(0.5);
|
||||
|
||||
// Save position and cryp details
|
||||
|
||||
@@ -9,6 +9,7 @@ const CombatHitBox = require('./combat.hitbox');
|
||||
|
||||
const renderResolutions = require('./combat.render.resolutions');
|
||||
|
||||
const aztecAtlas = require('../../assets/aztec.atlas.json');
|
||||
|
||||
class Combat extends Phaser.Scene {
|
||||
constructor() {
|
||||
@@ -18,8 +19,13 @@ class Combat extends Phaser.Scene {
|
||||
preload() {
|
||||
// Textures already loaded can do proper check in future when theres more textures
|
||||
if (!(this.textures.getTextureKeys().length > 2)) {
|
||||
this.textures.addBase64('alk', `data:image/png;base64,${new Buffer.from(fs.readFileSync('./assets/alakazam-f.png')).toString('base64')}`);
|
||||
this.textures.addBase64('magmar', `data:image/png;base64,${new Buffer.from(fs.readFileSync('./assets/magmar.png')).toString('base64')}`);
|
||||
const aztecImg = new Image();
|
||||
aztecImg.src = `data:image/png;base64,${new Buffer.from(fs.readFileSync('./assets/aztec.clean.png')).toString('base64')}`;
|
||||
aztecImg.onload = () => {
|
||||
this.textures.addAtlas('aztec', aztecImg, aztecAtlas);
|
||||
};
|
||||
// this.textures.addBase64('alk', `data:image/png;base64,${new Buffer.from(fs.readFileSync('./assets/magmar.png')).toString('base64')}`);
|
||||
// this.textures.addBase64('magmar', `data:image/png;base64,${new Buffer.from(fs.readFileSync('./assets/magmar.png')).toString('base64')}`);
|
||||
this.load.image('proj', 'https://labs.phaser.io/assets/sprites/bullet.png');
|
||||
this.load.image('blue', 'https://labs.phaser.io/assets/particles/blue.png');
|
||||
this.load.image('green', 'https://labs.phaser.io/assets/particles/green.png');
|
||||
@@ -45,7 +51,7 @@ class Combat extends Phaser.Scene {
|
||||
return ws.sendGameState(game.id);
|
||||
}
|
||||
return false;
|
||||
}, 2000);
|
||||
}, 500);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user