Atlas and random aztec cryp loading

This commit is contained in:
Mashy 2018-12-15 11:30:22 +10:00
parent ddc009f80e
commit 9087b9bebc
3 changed files with 455 additions and 5 deletions

444
client/assets/aztec.atlas.json Executable file
View File

@ -0,0 +1,444 @@
{
"textures": [
{
"format": "RGBA8888",
"size": {
"w": 1024,
"h": 1024
},
"scale": 1,
"frames":[
{
"filename":"sprite1",
"frame":{
"x":655,
"y":100,
"w":110,
"h":97
},
"rotated":false,
"trimmed":false,
"spriteSourceSize":{
"x":0,
"y":0,
"w":110,
"h":97
},
"sourceSize":{
"w":110,
"h":97
}
},
{
"filename":"sprite2",
"frame":{
"x":180,
"y":105,
"w":140,
"h":88
},
"rotated":false,
"trimmed":false,
"spriteSourceSize":{
"x":0,
"y":0,
"w":140,
"h":88
},
"sourceSize":{
"w":140,
"h":88
}
},
{
"filename":"sprite3",
"frame":{
"x":20,
"y":106,
"w":140,
"h":86
},
"rotated":false,
"trimmed":false,
"spriteSourceSize":{
"x":0,
"y":0,
"w":140,
"h":86
},
"sourceSize":{
"w":140,
"h":86
}
},
{
"filename":"sprite4",
"frame":{
"x":475,
"y":106,
"w":150,
"h":86
},
"rotated":false,
"trimmed":false,
"spriteSourceSize":{
"x":0,
"y":0,
"w":150,
"h":86
},
"sourceSize":{
"w":150,
"h":86
}
},
{
"filename":"sprite5",
"frame":{
"x":330,
"y":112,
"w":140,
"h":74
},
"rotated":false,
"trimmed":false,
"spriteSourceSize":{
"x":0,
"y":0,
"w":140,
"h":74
},
"sourceSize":{
"w":140,
"h":74
}
},
{
"filename":"sprite6",
"frame":{
"x":198,
"y":274,
"w":104,
"h":110
},
"rotated":false,
"trimmed":false,
"spriteSourceSize":{
"x":0,
"y":0,
"w":104,
"h":110
},
"sourceSize":{
"w":104,
"h":110
}
},
{
"filename":"sprite7",
"frame":{
"x":342,
"y":279,
"w":116,
"h":100
},
"rotated":false,
"trimmed":false,
"spriteSourceSize":{
"x":0,
"y":0,
"w":116,
"h":100
},
"sourceSize":{
"w":116,
"h":100
}
},
{
"filename":"sprite8",
"frame":{
"x":480,
"y":283,
"w":140,
"h":92
},
"rotated":false,
"trimmed":false,
"spriteSourceSize":{
"x":0,
"y":0,
"w":140,
"h":92
},
"sourceSize":{
"w":140,
"h":92
}
},
{
"filename":"sprite9",
"frame":{
"x":24,
"y":284,
"w":132,
"h":90
},
"rotated":false,
"trimmed":false,
"spriteSourceSize":{
"x":0,
"y":0,
"w":132,
"h":90
},
"sourceSize":{
"w":132,
"h":90
}
},
{
"filename":"sprite10",
"frame":{
"x":645,
"y":287,
"w":130,
"h":84
},
"rotated":false,
"trimmed":false,
"spriteSourceSize":{
"x":0,
"y":0,
"w":130,
"h":84
},
"sourceSize":{
"w":130,
"h":84
}
},
{
"filename":"sprite11",
"frame":{
"x":514,
"y":434,
"w":74,
"h":110
},
"rotated":false,
"trimmed":false,
"spriteSourceSize":{
"x":0,
"y":0,
"w":74,
"h":110
},
"sourceSize":{
"w":74,
"h":110
}
},
{
"filename":"sprite12",
"frame":{
"x":222,
"y":439,
"w":56,
"h":100
},
"rotated":false,
"trimmed":false,
"spriteSourceSize":{
"x":0,
"y":0,
"w":56,
"h":100
},
"sourceSize":{
"w":56,
"h":100
}
},
{
"filename":"sprite13",
"frame":{
"x":667,
"y":439,
"w":86,
"h":100
},
"rotated":false,
"trimmed":false,
"spriteSourceSize":{
"x":0,
"y":0,
"w":86,
"h":100
},
"sourceSize":{
"w":86,
"h":100
}
},
{
"filename":"sprite14",
"frame":{
"x":20,
"y":451,
"w":140,
"h":74
},
"rotated":false,
"trimmed":false,
"spriteSourceSize":{
"x":0,
"y":0,
"w":140,
"h":74
},
"sourceSize":{
"w":140,
"h":74
}
},
{
"filename":"sprite15",
"frame":{
"x":335,
"y":453,
"w":130,
"h":72
},
"rotated":false,
"trimmed":false,
"spriteSourceSize":{
"x":0,
"y":0,
"w":130,
"h":72
},
"sourceSize":{
"w":130,
"h":72
}
},
{
"filename":"sprite16",
"frame":{
"x":493,
"y":619,
"w":114,
"h":100
},
"rotated":false,
"trimmed":false,
"spriteSourceSize":{
"x":0,
"y":0,
"w":114,
"h":100
},
"sourceSize":{
"w":114,
"h":100
}
},
{
"filename":"sprite17",
"frame":{
"x":180,
"y":626,
"w":140,
"h":86
},
"rotated":false,
"trimmed":false,
"spriteSourceSize":{
"x":0,
"y":0,
"w":140,
"h":86
},
"sourceSize":{
"w":140,
"h":86
}
},
{
"filename":"sprite18",
"frame":{
"x":640,
"y":632,
"w":140,
"h":94
},
"rotated":false,
"trimmed":false,
"spriteSourceSize":{
"x":0,
"y":0,
"w":140,
"h":94
},
"sourceSize":{
"w":140,
"h":94
}
},
{
"filename":"sprite19",
"frame":{
"x":329,
"y":635,
"w":141,
"h":88
},
"rotated":false,
"trimmed":false,
"spriteSourceSize":{
"x":0,
"y":0,
"w":141,
"h":88
},
"sourceSize":{
"w":141,
"h":88
}
},
{
"filename":"sprite20",
"frame":{
"x":25,
"y":641,
"w":130,
"h":76
},
"rotated":false,
"trimmed":false,
"spriteSourceSize":{
"x":0,
"y":0,
"w":130,
"h":76
},
"sourceSize":{
"w":130,
"h":76
}
}
],
"meta":{
"app":"https://www.leshylabs.com/apps/sstool/",
"version":"Leshy SpriteSheet Tool v0.8.4",
"image":"spritesheet.png",
"size":{
"w":800,
"h":800
},
"scale":1
}
}
]
}

View File

@ -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

View File

@ -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;
}