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,
|
||||
"stats": {
|
||||
"health": 5,
|
||||
"speed": 2.4,
|
||||
"speed": 4,
|
||||
"special": null,
|
||||
"resistance": {
|
||||
"physical": 0,
|
||||
@ -19,9 +19,9 @@
|
||||
{
|
||||
"name": "quick",
|
||||
"textures": [],
|
||||
"textureArrayLength": 12,
|
||||
"textureArrayLength": 8,
|
||||
"stats": {
|
||||
"health": 3,
|
||||
"health": 2,
|
||||
"speed": 6,
|
||||
"special": null,
|
||||
"resistance": {
|
||||
@ -38,8 +38,8 @@
|
||||
"textures": [],
|
||||
"textureArrayLength": 12,
|
||||
"stats": {
|
||||
"health": 10,
|
||||
"speed": 2.4,
|
||||
"health": 12,
|
||||
"speed": 2,
|
||||
"special": null,
|
||||
"resistance": {
|
||||
"physical": 0,
|
||||
|
@ -2,6 +2,7 @@
|
||||
{
|
||||
"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.",
|
||||
"color": "red",
|
||||
"type": "Fire",
|
||||
"totalLevels": 2,
|
||||
"textures": [],
|
||||
@ -11,7 +12,7 @@
|
||||
"genericImprovements": [
|
||||
{
|
||||
"damageUp": 2,
|
||||
"attackSpeedUp": 100,
|
||||
"attackSpeedUp": 10,
|
||||
"rangeUp": 0.5,
|
||||
"timeToLiveUp": 0,
|
||||
"pierceUp": 1,
|
||||
@ -19,7 +20,7 @@
|
||||
},
|
||||
{
|
||||
"damageUp": 2,
|
||||
"attackSpeedUp": 100,
|
||||
"attackSpeedUp": 10,
|
||||
"rangeUp": 0.5,
|
||||
"timeToLiveUp": 0,
|
||||
"pierceUp": 1,
|
||||
@ -46,6 +47,7 @@
|
||||
{
|
||||
"name": "Yeti Gem",
|
||||
"description": "Yeti gem description. Something something, write this while drunk or something.",
|
||||
"color": "dodgerblue",
|
||||
"type": "Yeti",
|
||||
"totalLevels": 2,
|
||||
"textures": [],
|
||||
@ -55,7 +57,7 @@
|
||||
"genericImprovements": [
|
||||
{
|
||||
"damageUp": 2,
|
||||
"attackSpeedUp": 100,
|
||||
"attackSpeedUp": 10,
|
||||
"rangeUp": 0.5,
|
||||
"timeToLiveUp": 0,
|
||||
"pierceUp": 1,
|
||||
@ -63,7 +65,7 @@
|
||||
},
|
||||
{
|
||||
"damageUp": 2,
|
||||
"attackSpeedUp": 100,
|
||||
"attackSpeedUp": 10,
|
||||
"rangeUp": 0.5,
|
||||
"timeToLiveUp": 0,
|
||||
"pierceUp": 1,
|
||||
@ -90,6 +92,7 @@
|
||||
{
|
||||
"name": "Titalium Gem",
|
||||
"description": "Titalium gem description. Something something zombie creeps working for you something something.",
|
||||
"color": "pink",
|
||||
"type": "Titalium",
|
||||
"totalLevels": 3,
|
||||
"textures": [],
|
||||
@ -99,7 +102,7 @@
|
||||
"genericImprovements": [
|
||||
{
|
||||
"damageUp": 2,
|
||||
"attackSpeedUp": 100,
|
||||
"attackSpeedUp": 10,
|
||||
"rangeUp": 0.5,
|
||||
"timeToLiveUp": 0,
|
||||
"pierceUp": 1,
|
||||
@ -107,7 +110,7 @@
|
||||
},
|
||||
{
|
||||
"damageUp": 2,
|
||||
"attackSpeedUp": 100,
|
||||
"attackSpeedUp": 10,
|
||||
"rangeUp": 0,
|
||||
"timeToLiveUp": 0,
|
||||
"pierceUp": 1,
|
||||
@ -115,7 +118,7 @@
|
||||
},
|
||||
{
|
||||
"damageUp": 2,
|
||||
"attackSpeedUp": 100,
|
||||
"attackSpeedUp": 10,
|
||||
"rangeUp": 0,
|
||||
"timeToLiveUp": 0,
|
||||
"pierceUp": 1,
|
||||
@ -149,6 +152,7 @@
|
||||
{
|
||||
"name": "Soulforge Gem",
|
||||
"description": "Soulforge gem description, have to write later.",
|
||||
"color": "gray",
|
||||
"type": "Soulforge",
|
||||
"totalLevels": 2,
|
||||
"textures": [],
|
||||
@ -158,7 +162,7 @@
|
||||
"genericImprovements": [
|
||||
{
|
||||
"damageUp": 2,
|
||||
"attackSpeedUp": 100,
|
||||
"attackSpeedUp": 10,
|
||||
"rangeUp": 0.5,
|
||||
"timeToLiveUp": 0,
|
||||
"pierceUp": 1,
|
||||
@ -166,7 +170,7 @@
|
||||
},
|
||||
{
|
||||
"damageUp": 2,
|
||||
"attackSpeedUp": 100,
|
||||
"attackSpeedUp": 10,
|
||||
"rangeUp": 0.5,
|
||||
"timeToLiveUp": 0,
|
||||
"pierceUp": 1,
|
||||
|
@ -9,26 +9,30 @@
|
||||
"description": "The building block of society, nothing more basic exists.",
|
||||
"stats": {
|
||||
"damage": 2,
|
||||
"cooldown": 60,
|
||||
"cooldown": 120,
|
||||
"gemSlotsAmount": 2,
|
||||
"cost": 100,
|
||||
"range": 3
|
||||
"range": 3,
|
||||
"timeToLive": 120,
|
||||
"pierce": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Circle Tower",
|
||||
"behaviour": "BasicTowerBehaviour",
|
||||
"behaviour": "CircleTowerBehaviour",
|
||||
"sprite": "circle_tower",
|
||||
"texture": null,
|
||||
"projectileTextures": [],
|
||||
"projectileTexturesArrayLength": 4,
|
||||
"description": "If you feel a little circular.",
|
||||
"stats": {
|
||||
"damage": 6,
|
||||
"cooldown": 180,
|
||||
"damage": 2,
|
||||
"cooldown": 120,
|
||||
"gemSlotsAmount": 3,
|
||||
"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.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++) {
|
||||
this.GameScene.MissionStats.giveGem(new Gem(i % 4), true);
|
||||
}
|
||||
|
@ -68,11 +68,14 @@ export type TowerStatsDefinition = {
|
||||
gemSlotsAmount: number;
|
||||
cost: number;
|
||||
range: number;
|
||||
timeToLive: number;
|
||||
pierce: number;
|
||||
};
|
||||
|
||||
export type GemDefinition = {
|
||||
name: string;
|
||||
description: string;
|
||||
color: PIXI.ColorSource;
|
||||
type: GemType;
|
||||
totalLevels: number;
|
||||
textures: PIXI.Texture[];
|
||||
|
@ -24,6 +24,7 @@ export default abstract class GameObject {
|
||||
}
|
||||
|
||||
public copyContainerToBB() {
|
||||
if (this.container == null) return null;
|
||||
this.bb.x = this.container.x;
|
||||
this.bb.y = this.container.y;
|
||||
this.bb.width = this.container.width;
|
||||
|
@ -19,12 +19,16 @@ export default class Projectile extends GameObject {
|
||||
public angle: number;
|
||||
public speed: number;
|
||||
public damage: number;
|
||||
public timeToLive: number = 1;
|
||||
public pierce: number = 1;
|
||||
public timeToLive: number;
|
||||
public parent: Tower;
|
||||
constructor(x, y, textures, angle, damage, tint, tower) {
|
||||
private collidedCreepIDs = [];
|
||||
constructor(x, y, textures, angle, damage, tint, tower: Tower) {
|
||||
super();
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.timeToLive = tower.computedTimeToLive;
|
||||
this.pierce = tower.computedPierce;
|
||||
this.parent = tower;
|
||||
this.damage = damage;
|
||||
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) {
|
||||
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) => {
|
||||
if (this.timeToLive <= 0) return;
|
||||
if (creep.container && this.checkCollision(creep)) {
|
||||
this.timeToLive--;
|
||||
this.onCollide(creep);
|
||||
return;
|
||||
if (this.pierce <= 0) return;
|
||||
if (creep && creep.container && this.checkCollision(creep)) {
|
||||
let exists = this.collidedCreepIDs.find((c) => creep.id == c.id);
|
||||
if (!exists) {
|
||||
this.collidedCreepIDs.push(creep);
|
||||
this.pierce--;
|
||||
this.onCollide(creep);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
this.x += Math.cos(this.angle) * this.speed * elapsedMS;
|
||||
@ -67,7 +77,8 @@ export default class Projectile extends GameObject {
|
||||
}
|
||||
|
||||
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 otherbb = creep.copyContainerToBB();
|
||||
return mybb.getBounds().intersects(otherbb.getBounds());
|
||||
|
@ -1,13 +1,13 @@
|
||||
import { Engine } from '../Bastion';
|
||||
import * as PIXI from 'pixi.js';
|
||||
import GameObject from '../GameObject';
|
||||
import { TowerDefinition } from '../Definitions';
|
||||
import { GemType, TowerDefinition } from '../Definitions';
|
||||
import { Cell } from './Grid';
|
||||
import { TowerBehaviours } from './TowerManager';
|
||||
import Projectile, { calculateAngleToPoint } from './Projectile';
|
||||
import Creep from './Creep';
|
||||
import Gem from './Gem';
|
||||
import { BasicTowerBehaviour } from './TowerBehaviours';
|
||||
import { BasicTowerBehaviour, CircleTowerBehaviour } from './TowerBehaviours';
|
||||
|
||||
export function distance(x1, y1, x2, y2) {
|
||||
return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
|
||||
@ -25,6 +25,10 @@ export class Tower extends GameObject {
|
||||
public ticksUntilNextShot: number;
|
||||
public graphics: PIXI.Graphics = new PIXI.Graphics();
|
||||
public computedDamageToDeal: number;
|
||||
public computedAttackSpeed: number;
|
||||
public computedRange: number;
|
||||
public computedTimeToLive: number;
|
||||
public computedPierce: number;
|
||||
public parent: Cell;
|
||||
|
||||
constructor(row, column, texture, definition, behaviour) {
|
||||
@ -56,14 +60,13 @@ export class Tower extends GameObject {
|
||||
Engine.Grid.gridInteractionEnabled &&
|
||||
!Engine.GameScene.towerPanel.isShown
|
||||
)
|
||||
this.parent.showRangePreview(false, this.definition.stats.range);
|
||||
this.parent.showRangePreview(false, this.computedRange);
|
||||
};
|
||||
|
||||
private onParentCellLeave = (e) => {
|
||||
this.graphics.clear();
|
||||
};
|
||||
public SlotGem(gem: Gem, index: number) {
|
||||
console.log('ATTEMPTING TO SLOT ', gem, index);
|
||||
this.slottedGems[index] = gem;
|
||||
Engine.GameScene.towerPanel.Hide();
|
||||
Engine.GameScene.towerPanel.Show(this);
|
||||
@ -92,25 +95,37 @@ export class Tower extends GameObject {
|
||||
const y = creep.y;
|
||||
const towerX = this.column * 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);
|
||||
return d < radius + (Engine.GridCellSize * 2) / 3;
|
||||
});
|
||||
}
|
||||
public Shoot(creep: Creep) {
|
||||
public Shoot(angle) {
|
||||
let x = this.column * Engine.GridCellSize + Engine.GridCellSize / 2;
|
||||
let y = this.row * Engine.GridCellSize + Engine.GridCellSize / 2;
|
||||
let angle = calculateAngleToPoint(x, y, creep.x, creep.y);
|
||||
let tint = 0xffffff;
|
||||
let combinedTint = 0xffffff;
|
||||
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(
|
||||
new Projectile(x, y, this.definition.projectileTextures, angle, this.computedDamageToDeal, tint, this)
|
||||
let proj = new Projectile(
|
||||
x,
|
||||
y,
|
||||
this.definition.projectileTextures,
|
||||
angle,
|
||||
this.computedDamageToDeal,
|
||||
combinedTint,
|
||||
this
|
||||
);
|
||||
this.projectiles.push(proj);
|
||||
return proj;
|
||||
}
|
||||
public update(elapsedMS: any): void {
|
||||
if (this.behaviour == TowerBehaviours.BasicTowerBehaviour) BasicTowerBehaviour(this, elapsedMS);
|
||||
if (this.behaviour == TowerBehaviours.CircleTowerBehaviour) CircleTowerBehaviour(this, elapsedMS);
|
||||
}
|
||||
|
||||
public destroy(): void {
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { Engine } from '../Bastion';
|
||||
import { calculateAngleToPoint } from './Projectile';
|
||||
import { Tower } from './Tower';
|
||||
|
||||
/**
|
||||
@ -26,10 +28,24 @@ function projectileCheck(tower: Tower, elapsedMS: number) {
|
||||
*/
|
||||
export function computeGemImprovements(tower: Tower) {
|
||||
let gemDamage = 0;
|
||||
let gemAttackSpeedUp = 0;
|
||||
let gemRangeUp = 0;
|
||||
let gemTimeToLiveUp = 0;
|
||||
let gemPierceUp = 0;
|
||||
|
||||
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.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();
|
||||
if (creepsInRange.length > 0) {
|
||||
let focus = creepsInRange[0];
|
||||
if (tower.ticksUntilNextShot == 0) {
|
||||
tower.ticksUntilNextShot = tower.definition.stats.cooldown;
|
||||
tower.Shoot(focus);
|
||||
if (tower.ticksUntilNextShot <= 0) {
|
||||
let x = tower.column * Engine.GridCellSize + Engine.GridCellSize / 2;
|
||||
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 {
|
||||
BasicTowerBehaviour = 'BasicTowerBehaviour',
|
||||
CircleTowerBehaviour = 'CircleTowerBehaviour',
|
||||
}
|
||||
|
||||
export default class TowerManager {
|
||||
|
@ -246,14 +246,14 @@ export default class TowerPanel extends GuiObject {
|
||||
} else {
|
||||
this.ShowLeft();
|
||||
}
|
||||
tower.parent.showRangePreview(false, tower.definition.stats.range);
|
||||
tower.parent.showRangePreview(false, tower.computedRange);
|
||||
}
|
||||
private SetContent(tower: Tower) {
|
||||
this.titleText.text = tower.definition.name;
|
||||
this.damageText.text = 'Deals ' + tower.computedDamageToDeal + ' damage';
|
||||
this.totalDamage.text = 'Damage dealt: ' + tower.damageDealt + ' damage';
|
||||
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() {
|
||||
this.towerPanel.x = -100;
|
||||
@ -270,7 +270,7 @@ export default class TowerPanel extends GuiObject {
|
||||
public Hide() {
|
||||
this.isShown = false;
|
||||
this.container.alpha = 0;
|
||||
this.container.x = GameUIConstants.SidebarRect.x + 10;
|
||||
this.container.x = -1000;
|
||||
Engine.Grid.rangePreview.clear();
|
||||
}
|
||||
}
|
||||
|