Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
64ac63b5ef | |||
bdeb67e32e | |||
ca8bf01c78 | |||
8267ade858 | |||
5b18dd601a |
20
public/assets/creeps/optimize.cjs
Normal file
20
public/assets/creeps/optimize.cjs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
const { exec, execSync } = require('child_process');
|
||||||
|
let dir = fs.readdirSync('.');
|
||||||
|
// dir.forEach((item) => {
|
||||||
|
// const itemPath = `./${item}`;
|
||||||
|
// if (fs.lstatSync(itemPath).isDirectory()) {
|
||||||
|
// let subDir = fs.readdirSync(itemPath);
|
||||||
|
// subDir.forEach(async (subItem) => {
|
||||||
|
// const subItemPath = `${itemPath}/${subItem}`;
|
||||||
|
// if (fs.lstatSync(subItemPath).isFile() && subItem.endsWith('.png')) {
|
||||||
|
// const outputFilePath = `${itemPath}/${subItem.replace('.png', 's.png')}`;
|
||||||
|
// await execSync(`convert -resize 128x128 -quality 80 ${subItemPath} ${outputFilePath}`);
|
||||||
|
// fs.unlinkSync(subItemPath);
|
||||||
|
// fs.renameSync(outputFilePath, subItemPath);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// Disabled for now, dont need to optimize assets.
|
@ -86,11 +86,11 @@
|
|||||||
"speed": 3,
|
"speed": 3,
|
||||||
"special": null,
|
"special": null,
|
||||||
"resistance": {
|
"resistance": {
|
||||||
"physical": 0,
|
"physical": 1,
|
||||||
"divine": 0,
|
"divine": -0.25,
|
||||||
"fire": 0,
|
"fire": 1,
|
||||||
"ice": 0,
|
"ice": 1,
|
||||||
"frostfire": 0
|
"frostfire": 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -224,6 +224,14 @@ export default class Creep extends GameObject {
|
|||||||
this.container.y = this.y;
|
this.container.y = this.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public takeDamage(amount: number) {
|
||||||
|
// this.health -= amount;
|
||||||
|
// if (this.health < 0 && !this.died) {
|
||||||
|
// this.died = true;
|
||||||
|
// this.events.emit(CreepEvents.Died, this);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
public destroy() {
|
public destroy() {
|
||||||
super.destroy();
|
super.destroy();
|
||||||
this.container.removeChildren();
|
this.container.removeChildren();
|
||||||
|
@ -146,7 +146,7 @@ export class Grid extends GameObject {
|
|||||||
|
|
||||||
Engine.GameMaster.currentScene.stage.addChild(this.container);
|
Engine.GameMaster.currentScene.stage.addChild(this.container);
|
||||||
|
|
||||||
const background = new PIXI.Sprite(GameAssets.MissionBackgrounds[missionIndex]);
|
let background = new PIXI.Sprite(GameAssets.MissionBackgrounds[missionIndex]);
|
||||||
this.container.addChild(background);
|
this.container.addChild(background);
|
||||||
|
|
||||||
for (let y = 0; y < this.gameMap.columns; y++) {
|
for (let y = 0; y < this.gameMap.columns; y++) {
|
||||||
|
@ -62,7 +62,7 @@ export default class MissionStats extends GameObject {
|
|||||||
this.inventory.push(gem);
|
this.inventory.push(gem);
|
||||||
if (!noNotify)
|
if (!noNotify)
|
||||||
Engine.NotificationManager.Notify(
|
Engine.NotificationManager.Notify(
|
||||||
`Lv. ${gem.level} ${gem.definition.name} added to your inventory.`,
|
`Lv. ${gem.level} ${gem.definition.name}` + ' added to your inventory.',
|
||||||
'gemaward'
|
'gemaward'
|
||||||
);
|
);
|
||||||
Engine.GameScene.events.emit(StatsEvents.GemGivenEvent, gem);
|
Engine.GameScene.events.emit(StatsEvents.GemGivenEvent, gem);
|
||||||
|
@ -6,6 +6,7 @@ import { CreepEvents } from '../Events';
|
|||||||
import { distance, Tower } from './Tower';
|
import { distance, Tower } from './Tower';
|
||||||
import { CreepResistancesDefinition } from '../Definitions';
|
import { CreepResistancesDefinition } from '../Definitions';
|
||||||
import GameAssets from '../Assets';
|
import GameAssets from '../Assets';
|
||||||
|
import { RoundMode } from '../../scenes/Game';
|
||||||
|
|
||||||
export function calculateAngleToPoint(x, y, targetX, targetY) {
|
export function calculateAngleToPoint(x, y, targetX, targetY) {
|
||||||
const dx = targetX - x;
|
const dx = targetX - x;
|
||||||
@ -46,7 +47,6 @@ export default class Projectile extends GameObject {
|
|||||||
this.gemResistanceModifications = gemResistanceModifications;
|
this.gemResistanceModifications = gemResistanceModifications;
|
||||||
this.sprite = new PIXI.AnimatedSprite({ textures: textures, scale: 0.25, rotation: angle });
|
this.sprite = new PIXI.AnimatedSprite({ textures: textures, scale: 0.25, rotation: angle });
|
||||||
this.sprite.anchor.set(0.5, 0.5);
|
this.sprite.anchor.set(0.5, 0.5);
|
||||||
// this.sprite.tint = tint;
|
|
||||||
this.sprite.play();
|
this.sprite.play();
|
||||||
this.container.x = this.x;
|
this.container.x = this.x;
|
||||||
this.container.y = this.y;
|
this.container.y = this.y;
|
||||||
@ -71,7 +71,7 @@ export default class Projectile extends GameObject {
|
|||||||
Engine.Grid.creeps.forEach((creep) => {
|
Engine.Grid.creeps.forEach((creep) => {
|
||||||
if (this.pierce <= 0) return;
|
if (this.pierce <= 0) return;
|
||||||
if (creep && creep.container && this.checkCollision(creep)) {
|
if (creep && creep.container && this.checkCollision(creep)) {
|
||||||
const exists = this.collidedCreepIDs.find((c) => creep.id == c.id);
|
let exists = this.collidedCreepIDs.find((c) => creep.id == c.id);
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
this.collidedCreepIDs.push(creep);
|
this.collidedCreepIDs.push(creep);
|
||||||
this.pierce--;
|
this.pierce--;
|
||||||
@ -100,8 +100,8 @@ export default class Projectile extends GameObject {
|
|||||||
public checkCollision(creep: Creep) {
|
public checkCollision(creep: Creep) {
|
||||||
//console.debug(creep);
|
//console.debug(creep);
|
||||||
if (creep == null || creep.container == null || creep.container._position == null) return;
|
if (creep == null || creep.container == null || creep.container._position == null) return;
|
||||||
const mybb = this.copyContainerToBB();
|
let mybb = this.copyContainerToBB();
|
||||||
const otherbb = creep.copyContainerToBB();
|
let otherbb = creep.copyContainerToBB();
|
||||||
return mybb.getBounds().intersects(otherbb.getBounds());
|
return mybb.getBounds().intersects(otherbb.getBounds());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ export default class Tooltip extends GuiObject {
|
|||||||
this.gemAmount.alpha = 0;
|
this.gemAmount.alpha = 0;
|
||||||
this.gemDescriptionText.alpha = 1;
|
this.gemDescriptionText.alpha = 1;
|
||||||
|
|
||||||
this.titleText.text = `Lv. ${gem.level} ${gem.definition.name}`;
|
this.titleText.text = `Lv. ${gem.level} ` + gem.definition.name;
|
||||||
let costToLevelUp;
|
let costToLevelUp;
|
||||||
if (!gem.isMaxLevel())
|
if (!gem.isMaxLevel())
|
||||||
costToLevelUp = `Costs ${gem.definition.genericImprovements[gem.level].gemValueUp} gold to level up.`;
|
costToLevelUp = `Costs ${gem.definition.genericImprovements[gem.level].gemValueUp} gold to level up.`;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user