add more content
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.1 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.1 KiB |
BIN
public/assets/creeps/cloaker/0.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
public/assets/creeps/cloaker/1.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
public/assets/creeps/cloaker/10.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
public/assets/creeps/cloaker/11.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
public/assets/creeps/cloaker/2.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
public/assets/creeps/cloaker/3.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
public/assets/creeps/cloaker/4.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
public/assets/creeps/cloaker/5.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
public/assets/creeps/cloaker/6.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
public/assets/creeps/cloaker/7.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
public/assets/creeps/cloaker/8.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
public/assets/creeps/cloaker/9.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
public/assets/creeps/demon/0.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
public/assets/creeps/demon/1.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
public/assets/creeps/demon/2.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
public/assets/creeps/demon/3.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
public/assets/creeps/demon/4.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
public/assets/creeps/demon/5.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
public/assets/creeps/demon/6.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
public/assets/creeps/demon/7.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
public/assets/creeps/maker/1.png
Normal file
After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
BIN
public/assets/creeps/maker/2.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
public/assets/creeps/maker/3.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
public/assets/creeps/maker/4.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
public/assets/creeps/maker/5.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
public/assets/creeps/maker/6.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
public/assets/creeps/maker/7.png
Normal file
After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@ -5,7 +5,7 @@
|
|||||||
"textureArrayLength": 12,
|
"textureArrayLength": 12,
|
||||||
"stats": {
|
"stats": {
|
||||||
"health": 5,
|
"health": 5,
|
||||||
"speed": 2.4,
|
"speed": 4,
|
||||||
"special": null,
|
"special": null,
|
||||||
"resistance": {
|
"resistance": {
|
||||||
"physical": 0,
|
"physical": 0,
|
||||||
@ -19,9 +19,9 @@
|
|||||||
{
|
{
|
||||||
"name": "quick",
|
"name": "quick",
|
||||||
"textures": [],
|
"textures": [],
|
||||||
"textureArrayLength": 12,
|
"textureArrayLength": 8,
|
||||||
"stats": {
|
"stats": {
|
||||||
"health": 3,
|
"health": 2,
|
||||||
"speed": 6,
|
"speed": 6,
|
||||||
"special": null,
|
"special": null,
|
||||||
"resistance": {
|
"resistance": {
|
||||||
@ -38,8 +38,8 @@
|
|||||||
"textures": [],
|
"textures": [],
|
||||||
"textureArrayLength": 12,
|
"textureArrayLength": 12,
|
||||||
"stats": {
|
"stats": {
|
||||||
"health": 10,
|
"health": 12,
|
||||||
"speed": 2.4,
|
"speed": 2,
|
||||||
"special": null,
|
"special": null,
|
||||||
"resistance": {
|
"resistance": {
|
||||||
"physical": 0,
|
"physical": 0,
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Fire Gem",
|
"name": "Fire Gem",
|
||||||
"description": "Forged from molten lava, the Fire Gem imbues your tower's attacks and adds 50% extra fire damage. It can be merged with any gem and is common. This text shouldn't be long.",
|
"description": "Forged from molten lava, the Fire Gem imbues your tower's attacks and adds 50% extra fire damage. It can be merged with any gem and is common. This text shouldn't be long.",
|
||||||
|
"color": "red",
|
||||||
"type": "Fire",
|
"type": "Fire",
|
||||||
"totalLevels": 2,
|
"totalLevels": 2,
|
||||||
"textures": [],
|
"textures": [],
|
||||||
@ -11,7 +12,7 @@
|
|||||||
"genericImprovements": [
|
"genericImprovements": [
|
||||||
{
|
{
|
||||||
"damageUp": 2,
|
"damageUp": 2,
|
||||||
"attackSpeedUp": 100,
|
"attackSpeedUp": 10,
|
||||||
"rangeUp": 0.5,
|
"rangeUp": 0.5,
|
||||||
"timeToLiveUp": 0,
|
"timeToLiveUp": 0,
|
||||||
"pierceUp": 1,
|
"pierceUp": 1,
|
||||||
@ -19,7 +20,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"damageUp": 2,
|
"damageUp": 2,
|
||||||
"attackSpeedUp": 100,
|
"attackSpeedUp": 10,
|
||||||
"rangeUp": 0.5,
|
"rangeUp": 0.5,
|
||||||
"timeToLiveUp": 0,
|
"timeToLiveUp": 0,
|
||||||
"pierceUp": 1,
|
"pierceUp": 1,
|
||||||
@ -46,6 +47,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Yeti Gem",
|
"name": "Yeti Gem",
|
||||||
"description": "Yeti gem description. Something something, write this while drunk or something.",
|
"description": "Yeti gem description. Something something, write this while drunk or something.",
|
||||||
|
"color": "dodgerblue",
|
||||||
"type": "Yeti",
|
"type": "Yeti",
|
||||||
"totalLevels": 2,
|
"totalLevels": 2,
|
||||||
"textures": [],
|
"textures": [],
|
||||||
@ -55,7 +57,7 @@
|
|||||||
"genericImprovements": [
|
"genericImprovements": [
|
||||||
{
|
{
|
||||||
"damageUp": 2,
|
"damageUp": 2,
|
||||||
"attackSpeedUp": 100,
|
"attackSpeedUp": 10,
|
||||||
"rangeUp": 0.5,
|
"rangeUp": 0.5,
|
||||||
"timeToLiveUp": 0,
|
"timeToLiveUp": 0,
|
||||||
"pierceUp": 1,
|
"pierceUp": 1,
|
||||||
@ -63,7 +65,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"damageUp": 2,
|
"damageUp": 2,
|
||||||
"attackSpeedUp": 100,
|
"attackSpeedUp": 10,
|
||||||
"rangeUp": 0.5,
|
"rangeUp": 0.5,
|
||||||
"timeToLiveUp": 0,
|
"timeToLiveUp": 0,
|
||||||
"pierceUp": 1,
|
"pierceUp": 1,
|
||||||
@ -90,6 +92,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Titalium Gem",
|
"name": "Titalium Gem",
|
||||||
"description": "Titalium gem description. Something something zombie creeps working for you something something.",
|
"description": "Titalium gem description. Something something zombie creeps working for you something something.",
|
||||||
|
"color": "pink",
|
||||||
"type": "Titalium",
|
"type": "Titalium",
|
||||||
"totalLevels": 3,
|
"totalLevels": 3,
|
||||||
"textures": [],
|
"textures": [],
|
||||||
@ -99,7 +102,7 @@
|
|||||||
"genericImprovements": [
|
"genericImprovements": [
|
||||||
{
|
{
|
||||||
"damageUp": 2,
|
"damageUp": 2,
|
||||||
"attackSpeedUp": 100,
|
"attackSpeedUp": 10,
|
||||||
"rangeUp": 0.5,
|
"rangeUp": 0.5,
|
||||||
"timeToLiveUp": 0,
|
"timeToLiveUp": 0,
|
||||||
"pierceUp": 1,
|
"pierceUp": 1,
|
||||||
@ -107,7 +110,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"damageUp": 2,
|
"damageUp": 2,
|
||||||
"attackSpeedUp": 100,
|
"attackSpeedUp": 10,
|
||||||
"rangeUp": 0,
|
"rangeUp": 0,
|
||||||
"timeToLiveUp": 0,
|
"timeToLiveUp": 0,
|
||||||
"pierceUp": 1,
|
"pierceUp": 1,
|
||||||
@ -115,7 +118,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"damageUp": 2,
|
"damageUp": 2,
|
||||||
"attackSpeedUp": 100,
|
"attackSpeedUp": 10,
|
||||||
"rangeUp": 0,
|
"rangeUp": 0,
|
||||||
"timeToLiveUp": 0,
|
"timeToLiveUp": 0,
|
||||||
"pierceUp": 1,
|
"pierceUp": 1,
|
||||||
@ -149,6 +152,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Soulforge Gem",
|
"name": "Soulforge Gem",
|
||||||
"description": "Soulforge gem description, have to write later.",
|
"description": "Soulforge gem description, have to write later.",
|
||||||
|
"color": "gray",
|
||||||
"type": "Soulforge",
|
"type": "Soulforge",
|
||||||
"totalLevels": 2,
|
"totalLevels": 2,
|
||||||
"textures": [],
|
"textures": [],
|
||||||
@ -158,7 +162,7 @@
|
|||||||
"genericImprovements": [
|
"genericImprovements": [
|
||||||
{
|
{
|
||||||
"damageUp": 2,
|
"damageUp": 2,
|
||||||
"attackSpeedUp": 100,
|
"attackSpeedUp": 10,
|
||||||
"rangeUp": 0.5,
|
"rangeUp": 0.5,
|
||||||
"timeToLiveUp": 0,
|
"timeToLiveUp": 0,
|
||||||
"pierceUp": 1,
|
"pierceUp": 1,
|
||||||
@ -166,7 +170,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"damageUp": 2,
|
"damageUp": 2,
|
||||||
"attackSpeedUp": 100,
|
"attackSpeedUp": 10,
|
||||||
"rangeUp": 0.5,
|
"rangeUp": 0.5,
|
||||||
"timeToLiveUp": 0,
|
"timeToLiveUp": 0,
|
||||||
"pierceUp": 1,
|
"pierceUp": 1,
|
||||||
|
@ -9,26 +9,30 @@
|
|||||||
"description": "The building block of society, nothing more basic exists.",
|
"description": "The building block of society, nothing more basic exists.",
|
||||||
"stats": {
|
"stats": {
|
||||||
"damage": 2,
|
"damage": 2,
|
||||||
"cooldown": 60,
|
"cooldown": 120,
|
||||||
"gemSlotsAmount": 2,
|
"gemSlotsAmount": 2,
|
||||||
"cost": 100,
|
"cost": 100,
|
||||||
"range": 3
|
"range": 3,
|
||||||
|
"timeToLive": 120,
|
||||||
|
"pierce": 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Circle Tower",
|
"name": "Circle Tower",
|
||||||
"behaviour": "BasicTowerBehaviour",
|
"behaviour": "CircleTowerBehaviour",
|
||||||
"sprite": "circle_tower",
|
"sprite": "circle_tower",
|
||||||
"texture": null,
|
"texture": null,
|
||||||
"projectileTextures": [],
|
"projectileTextures": [],
|
||||||
"projectileTexturesArrayLength": 4,
|
"projectileTexturesArrayLength": 4,
|
||||||
"description": "If you feel a little circular.",
|
"description": "If you feel a little circular.",
|
||||||
"stats": {
|
"stats": {
|
||||||
"damage": 6,
|
"damage": 2,
|
||||||
"cooldown": 180,
|
"cooldown": 120,
|
||||||
"gemSlotsAmount": 3,
|
"gemSlotsAmount": 3,
|
||||||
"cost": 125,
|
"cost": 125,
|
||||||
"range": 3
|
"range": 2,
|
||||||
|
"timeToLive": 8,
|
||||||
|
"pierce": 30
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -36,7 +36,7 @@ export class Engine {
|
|||||||
|
|
||||||
Engine.NotificationManager.Notify('Loaded testing suite.', 'danger');
|
Engine.NotificationManager.Notify('Loaded testing suite.', 'danger');
|
||||||
Engine.TowerManager.ToggleChoosingTowerLocation('RESET');
|
Engine.TowerManager.ToggleChoosingTowerLocation('RESET');
|
||||||
Engine.TowerManager.PlaceTower(GameAssets.Towers[1], 8, 10, GameAssets.Towers[0].behaviour, true);
|
Engine.TowerManager.PlaceTower(GameAssets.Towers[1], 6, 10, GameAssets.Towers[1].behaviour, true);
|
||||||
for (let i = 0; i < 29; i++) {
|
for (let i = 0; i < 29; i++) {
|
||||||
this.GameScene.MissionStats.giveGem(new Gem(i % 4), true);
|
this.GameScene.MissionStats.giveGem(new Gem(i % 4), true);
|
||||||
}
|
}
|
||||||
|
@ -68,11 +68,14 @@ export type TowerStatsDefinition = {
|
|||||||
gemSlotsAmount: number;
|
gemSlotsAmount: number;
|
||||||
cost: number;
|
cost: number;
|
||||||
range: number;
|
range: number;
|
||||||
|
timeToLive: number;
|
||||||
|
pierce: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type GemDefinition = {
|
export type GemDefinition = {
|
||||||
name: string;
|
name: string;
|
||||||
description: string;
|
description: string;
|
||||||
|
color: PIXI.ColorSource;
|
||||||
type: GemType;
|
type: GemType;
|
||||||
totalLevels: number;
|
totalLevels: number;
|
||||||
textures: PIXI.Texture[];
|
textures: PIXI.Texture[];
|
||||||
|
@ -24,6 +24,7 @@ export default abstract class GameObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public copyContainerToBB() {
|
public copyContainerToBB() {
|
||||||
|
if (this.container == null) return null;
|
||||||
this.bb.x = this.container.x;
|
this.bb.x = this.container.x;
|
||||||
this.bb.y = this.container.y;
|
this.bb.y = this.container.y;
|
||||||
this.bb.width = this.container.width;
|
this.bb.width = this.container.width;
|
||||||
|
@ -19,12 +19,16 @@ export default class Projectile extends GameObject {
|
|||||||
public angle: number;
|
public angle: number;
|
||||||
public speed: number;
|
public speed: number;
|
||||||
public damage: number;
|
public damage: number;
|
||||||
public timeToLive: number = 1;
|
public pierce: number = 1;
|
||||||
|
public timeToLive: number;
|
||||||
public parent: Tower;
|
public parent: Tower;
|
||||||
constructor(x, y, textures, angle, damage, tint, tower) {
|
private collidedCreepIDs = [];
|
||||||
|
constructor(x, y, textures, angle, damage, tint, tower: Tower) {
|
||||||
super();
|
super();
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
|
this.timeToLive = tower.computedTimeToLive;
|
||||||
|
this.pierce = tower.computedPierce;
|
||||||
this.parent = tower;
|
this.parent = tower;
|
||||||
this.damage = damage;
|
this.damage = damage;
|
||||||
this.sprite = new PIXI.AnimatedSprite({ textures: textures, scale: 0.25, rotation: angle });
|
this.sprite = new PIXI.AnimatedSprite({ textures: textures, scale: 0.25, rotation: angle });
|
||||||
@ -46,13 +50,19 @@ export default class Projectile extends GameObject {
|
|||||||
|
|
||||||
public update(elapsedMS) {
|
public update(elapsedMS) {
|
||||||
if (this.deleteMe) return;
|
if (this.deleteMe) return;
|
||||||
if (this.x > 2000 || this.x < 0 || this.y > 2000 || this.y < 0 || this.timeToLive <= 0) return this.destroy();
|
if (this.x > 2000 || this.x < 0 || this.y > 2000 || this.y < 0 || this.pierce <= 0 || this.timeToLive <= 0)
|
||||||
|
return this.destroy();
|
||||||
|
this.timeToLive--;
|
||||||
Engine.Grid.creeps.forEach((creep) => {
|
Engine.Grid.creeps.forEach((creep) => {
|
||||||
if (this.timeToLive <= 0) return;
|
if (this.pierce <= 0) return;
|
||||||
if (creep.container && this.checkCollision(creep)) {
|
if (creep && creep.container && this.checkCollision(creep)) {
|
||||||
this.timeToLive--;
|
let exists = this.collidedCreepIDs.find((c) => creep.id == c.id);
|
||||||
this.onCollide(creep);
|
if (!exists) {
|
||||||
return;
|
this.collidedCreepIDs.push(creep);
|
||||||
|
this.pierce--;
|
||||||
|
this.onCollide(creep);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.x += Math.cos(this.angle) * this.speed * elapsedMS;
|
this.x += Math.cos(this.angle) * this.speed * elapsedMS;
|
||||||
@ -67,7 +77,8 @@ export default class Projectile extends GameObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public checkCollision(creep: Creep) {
|
public checkCollision(creep: Creep) {
|
||||||
if (creep == null) return;
|
console.debug(creep);
|
||||||
|
if (creep == null || creep.container == null || creep.container._position == null) return;
|
||||||
let mybb = this.copyContainerToBB();
|
let mybb = this.copyContainerToBB();
|
||||||
let otherbb = creep.copyContainerToBB();
|
let otherbb = creep.copyContainerToBB();
|
||||||
return mybb.getBounds().intersects(otherbb.getBounds());
|
return mybb.getBounds().intersects(otherbb.getBounds());
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import { Engine } from '../Bastion';
|
import { Engine } from '../Bastion';
|
||||||
import * as PIXI from 'pixi.js';
|
import * as PIXI from 'pixi.js';
|
||||||
import GameObject from '../GameObject';
|
import GameObject from '../GameObject';
|
||||||
import { TowerDefinition } from '../Definitions';
|
import { GemType, TowerDefinition } from '../Definitions';
|
||||||
import { Cell } from './Grid';
|
import { Cell } from './Grid';
|
||||||
import { TowerBehaviours } from './TowerManager';
|
import { TowerBehaviours } from './TowerManager';
|
||||||
import Projectile, { calculateAngleToPoint } from './Projectile';
|
import Projectile, { calculateAngleToPoint } from './Projectile';
|
||||||
import Creep from './Creep';
|
import Creep from './Creep';
|
||||||
import Gem from './Gem';
|
import Gem from './Gem';
|
||||||
import { BasicTowerBehaviour } from './TowerBehaviours';
|
import { BasicTowerBehaviour, CircleTowerBehaviour } from './TowerBehaviours';
|
||||||
|
|
||||||
export function distance(x1, y1, x2, y2) {
|
export function distance(x1, y1, x2, y2) {
|
||||||
return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
|
return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
|
||||||
@ -25,6 +25,10 @@ export class Tower extends GameObject {
|
|||||||
public ticksUntilNextShot: number;
|
public ticksUntilNextShot: number;
|
||||||
public graphics: PIXI.Graphics = new PIXI.Graphics();
|
public graphics: PIXI.Graphics = new PIXI.Graphics();
|
||||||
public computedDamageToDeal: number;
|
public computedDamageToDeal: number;
|
||||||
|
public computedAttackSpeed: number;
|
||||||
|
public computedRange: number;
|
||||||
|
public computedTimeToLive: number;
|
||||||
|
public computedPierce: number;
|
||||||
public parent: Cell;
|
public parent: Cell;
|
||||||
|
|
||||||
constructor(row, column, texture, definition, behaviour) {
|
constructor(row, column, texture, definition, behaviour) {
|
||||||
@ -56,14 +60,13 @@ export class Tower extends GameObject {
|
|||||||
Engine.Grid.gridInteractionEnabled &&
|
Engine.Grid.gridInteractionEnabled &&
|
||||||
!Engine.GameScene.towerPanel.isShown
|
!Engine.GameScene.towerPanel.isShown
|
||||||
)
|
)
|
||||||
this.parent.showRangePreview(false, this.definition.stats.range);
|
this.parent.showRangePreview(false, this.computedRange);
|
||||||
};
|
};
|
||||||
|
|
||||||
private onParentCellLeave = (e) => {
|
private onParentCellLeave = (e) => {
|
||||||
this.graphics.clear();
|
this.graphics.clear();
|
||||||
};
|
};
|
||||||
public SlotGem(gem: Gem, index: number) {
|
public SlotGem(gem: Gem, index: number) {
|
||||||
console.log('ATTEMPTING TO SLOT ', gem, index);
|
|
||||||
this.slottedGems[index] = gem;
|
this.slottedGems[index] = gem;
|
||||||
Engine.GameScene.towerPanel.Hide();
|
Engine.GameScene.towerPanel.Hide();
|
||||||
Engine.GameScene.towerPanel.Show(this);
|
Engine.GameScene.towerPanel.Show(this);
|
||||||
@ -92,25 +95,37 @@ export class Tower extends GameObject {
|
|||||||
const y = creep.y;
|
const y = creep.y;
|
||||||
const towerX = this.column * Engine.GridCellSize + Engine.GridCellSize / 2;
|
const towerX = this.column * Engine.GridCellSize + Engine.GridCellSize / 2;
|
||||||
const towerY = this.row * Engine.GridCellSize + Engine.GridCellSize / 2;
|
const towerY = this.row * Engine.GridCellSize + Engine.GridCellSize / 2;
|
||||||
const radius = this.definition.stats.range * Engine.GridCellSize;
|
const radius = this.computedRange * Engine.GridCellSize;
|
||||||
const d = distance(towerX, towerY, x, y);
|
const d = distance(towerX, towerY, x, y);
|
||||||
return d < radius + (Engine.GridCellSize * 2) / 3;
|
return d < radius + (Engine.GridCellSize * 2) / 3;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
public Shoot(creep: Creep) {
|
public Shoot(angle) {
|
||||||
let x = this.column * Engine.GridCellSize + Engine.GridCellSize / 2;
|
let x = this.column * Engine.GridCellSize + Engine.GridCellSize / 2;
|
||||||
let y = this.row * Engine.GridCellSize + Engine.GridCellSize / 2;
|
let y = this.row * Engine.GridCellSize + Engine.GridCellSize / 2;
|
||||||
let angle = calculateAngleToPoint(x, y, creep.x, creep.y);
|
let combinedTint = 0xffffff;
|
||||||
let tint = 0xffffff;
|
|
||||||
this.slottedGems.forEach((gem) => {
|
this.slottedGems.forEach((gem) => {
|
||||||
if (gem.definition.type.toString() == 'Fire') tint = 0xff0000;
|
let rgb = new PIXI.Color(gem.definition.color).toRgb();
|
||||||
|
combinedTint =
|
||||||
|
((combinedTint & 0xff0000) + (rgb.r << 16)) |
|
||||||
|
((combinedTint & 0x00ff00) + (rgb.g << 8)) |
|
||||||
|
((combinedTint & 0x0000ff) + rgb.b);
|
||||||
});
|
});
|
||||||
this.projectiles.push(
|
let proj = new Projectile(
|
||||||
new Projectile(x, y, this.definition.projectileTextures, angle, this.computedDamageToDeal, tint, this)
|
x,
|
||||||
|
y,
|
||||||
|
this.definition.projectileTextures,
|
||||||
|
angle,
|
||||||
|
this.computedDamageToDeal,
|
||||||
|
combinedTint,
|
||||||
|
this
|
||||||
);
|
);
|
||||||
|
this.projectiles.push(proj);
|
||||||
|
return proj;
|
||||||
}
|
}
|
||||||
public update(elapsedMS: any): void {
|
public update(elapsedMS: any): void {
|
||||||
if (this.behaviour == TowerBehaviours.BasicTowerBehaviour) BasicTowerBehaviour(this, elapsedMS);
|
if (this.behaviour == TowerBehaviours.BasicTowerBehaviour) BasicTowerBehaviour(this, elapsedMS);
|
||||||
|
if (this.behaviour == TowerBehaviours.CircleTowerBehaviour) CircleTowerBehaviour(this, elapsedMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public destroy(): void {
|
public destroy(): void {
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { Engine } from '../Bastion';
|
||||||
|
import { calculateAngleToPoint } from './Projectile';
|
||||||
import { Tower } from './Tower';
|
import { Tower } from './Tower';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -26,10 +28,24 @@ function projectileCheck(tower: Tower, elapsedMS: number) {
|
|||||||
*/
|
*/
|
||||||
export function computeGemImprovements(tower: Tower) {
|
export function computeGemImprovements(tower: Tower) {
|
||||||
let gemDamage = 0;
|
let gemDamage = 0;
|
||||||
|
let gemAttackSpeedUp = 0;
|
||||||
|
let gemRangeUp = 0;
|
||||||
|
let gemTimeToLiveUp = 0;
|
||||||
|
let gemPierceUp = 0;
|
||||||
|
|
||||||
tower.slottedGems.forEach((gem) => {
|
tower.slottedGems.forEach((gem) => {
|
||||||
gemDamage += gem.currentGemImprovement().damageUp;
|
let ccurrentGemImprovements = gem.currentGemImprovement();
|
||||||
|
gemDamage += ccurrentGemImprovements.damageUp;
|
||||||
|
gemAttackSpeedUp += ccurrentGemImprovements.attackSpeedUp;
|
||||||
|
gemRangeUp += ccurrentGemImprovements.rangeUp;
|
||||||
|
gemTimeToLiveUp += ccurrentGemImprovements.timeToLiveUp;
|
||||||
|
gemPierceUp += ccurrentGemImprovements.pierceUp;
|
||||||
});
|
});
|
||||||
tower.computedDamageToDeal = tower.definition.stats.damage + gemDamage;
|
tower.computedDamageToDeal = tower.definition.stats.damage + gemDamage;
|
||||||
|
tower.computedAttackSpeed = tower.definition.stats.cooldown - gemAttackSpeedUp;
|
||||||
|
tower.computedRange = tower.definition.stats.range + gemRangeUp;
|
||||||
|
tower.computedTimeToLive = tower.definition.stats.timeToLive + gemTimeToLiveUp;
|
||||||
|
tower.computedPierce = tower.definition.stats.pierce + gemPierceUp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -46,9 +62,34 @@ export function BasicTowerBehaviour(tower: Tower, elapsedMS: number) {
|
|||||||
let creepsInRange = tower.GetCreepsInRange();
|
let creepsInRange = tower.GetCreepsInRange();
|
||||||
if (creepsInRange.length > 0) {
|
if (creepsInRange.length > 0) {
|
||||||
let focus = creepsInRange[0];
|
let focus = creepsInRange[0];
|
||||||
if (tower.ticksUntilNextShot == 0) {
|
if (tower.ticksUntilNextShot <= 0) {
|
||||||
tower.ticksUntilNextShot = tower.definition.stats.cooldown;
|
let x = tower.column * Engine.GridCellSize + Engine.GridCellSize / 2;
|
||||||
tower.Shoot(focus);
|
let y = tower.row * Engine.GridCellSize + Engine.GridCellSize / 2;
|
||||||
|
tower.ticksUntilNextShot = tower.computedAttackSpeed;
|
||||||
|
tower.Shoot(calculateAngleToPoint(x, y, focus.x, focus.y));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function CircleTowerBehaviour(tower: Tower, elapsedMS: number) {
|
||||||
|
if (tower.ticksUntilNextShot % 2 == 0) computeGemImprovements(tower);
|
||||||
|
projectileCheck(tower, elapsedMS);
|
||||||
|
if (tower.ticksUntilNextShot > 0) tower.ticksUntilNextShot--;
|
||||||
|
let creepsInRange = tower.GetCreepsInRange();
|
||||||
|
if (creepsInRange.length > 0) {
|
||||||
|
let focus = creepsInRange[0];
|
||||||
|
if (tower.ticksUntilNextShot <= 0) {
|
||||||
|
tower.ticksUntilNextShot = tower.computedAttackSpeed;
|
||||||
|
let x = tower.column * Engine.GridCellSize + Engine.GridCellSize / 2;
|
||||||
|
let y = tower.row * Engine.GridCellSize + Engine.GridCellSize / 2;
|
||||||
|
tower.Shoot(calculateAngleToPoint(x, y, x, y + 10)); // Up
|
||||||
|
tower.Shoot(calculateAngleToPoint(x, y, x + 10, y)); // Right
|
||||||
|
tower.Shoot(calculateAngleToPoint(x, y, x - 10, y)); // Left
|
||||||
|
tower.Shoot(calculateAngleToPoint(x, y, x, y - 10)); // Down
|
||||||
|
tower.Shoot(calculateAngleToPoint(x, y, x + 10, y + 10)); // Up right
|
||||||
|
tower.Shoot(calculateAngleToPoint(x, y, x - 10, y + 10)); // Up left
|
||||||
|
tower.Shoot(calculateAngleToPoint(x, y, x - 10, y - 10)); // Down left
|
||||||
|
tower.Shoot(calculateAngleToPoint(x, y, x + 10, y - 10)); // Down right
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import { GridEvents, TowerEvents } from '../Events';
|
|||||||
|
|
||||||
export enum TowerBehaviours {
|
export enum TowerBehaviours {
|
||||||
BasicTowerBehaviour = 'BasicTowerBehaviour',
|
BasicTowerBehaviour = 'BasicTowerBehaviour',
|
||||||
|
CircleTowerBehaviour = 'CircleTowerBehaviour',
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class TowerManager {
|
export default class TowerManager {
|
||||||
|
@ -246,14 +246,14 @@ export default class TowerPanel extends GuiObject {
|
|||||||
} else {
|
} else {
|
||||||
this.ShowLeft();
|
this.ShowLeft();
|
||||||
}
|
}
|
||||||
tower.parent.showRangePreview(false, tower.definition.stats.range);
|
tower.parent.showRangePreview(false, tower.computedRange);
|
||||||
}
|
}
|
||||||
private SetContent(tower: Tower) {
|
private SetContent(tower: Tower) {
|
||||||
this.titleText.text = tower.definition.name;
|
this.titleText.text = tower.definition.name;
|
||||||
this.damageText.text = 'Deals ' + tower.computedDamageToDeal + ' damage';
|
this.damageText.text = 'Deals ' + tower.computedDamageToDeal + ' damage';
|
||||||
this.totalDamage.text = 'Damage dealt: ' + tower.damageDealt + ' damage';
|
this.totalDamage.text = 'Damage dealt: ' + tower.damageDealt + ' damage';
|
||||||
this.attackSpeedText.x = this.damageText.width + 10;
|
this.attackSpeedText.x = this.damageText.width + 10;
|
||||||
this.attackSpeedText.text = ` every ${Math.floor(tower.definition.stats.cooldown / 60)}s`;
|
this.attackSpeedText.text = ` every ${Math.floor((tower.computedAttackSpeed / 60) * 100) / 100}s`;
|
||||||
}
|
}
|
||||||
private ShowLeft() {
|
private ShowLeft() {
|
||||||
this.towerPanel.x = -100;
|
this.towerPanel.x = -100;
|
||||||
@ -270,7 +270,7 @@ export default class TowerPanel extends GuiObject {
|
|||||||
public Hide() {
|
public Hide() {
|
||||||
this.isShown = false;
|
this.isShown = false;
|
||||||
this.container.alpha = 0;
|
this.container.alpha = 0;
|
||||||
this.container.x = GameUIConstants.SidebarRect.x + 10;
|
this.container.x = -1000;
|
||||||
Engine.Grid.rangePreview.clear();
|
Engine.Grid.rangePreview.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|