i have to think more about it
This commit is contained in:
parent
c57e84633b
commit
2f3bb621c7
Before Width: | Height: | Size: 3.3 MiB After Width: | Height: | Size: 3.3 MiB |
@ -102,7 +102,7 @@
|
|||||||
"creeps": [0, 0, 0, 0, 0]
|
"creeps": [0, 0, 0, 0, 0]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"offeredGems": [0, 1, 2, 3]
|
"offeredGems": [0, 0, 0, 0]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"waves": [
|
"waves": [
|
||||||
|
@ -22,6 +22,7 @@ export default class GameAssets {
|
|||||||
public static WaveTexture: PIXI.Texture;
|
public static WaveTexture: PIXI.Texture;
|
||||||
public static SwordsTexture: PIXI.Texture;
|
public static SwordsTexture: PIXI.Texture;
|
||||||
public static TitleTexture: PIXI.Texture;
|
public static TitleTexture: PIXI.Texture;
|
||||||
|
public static GemFrame: PIXI.Texture;
|
||||||
|
|
||||||
public static PlayIconTexture: PIXI.Texture;
|
public static PlayIconTexture: PIXI.Texture;
|
||||||
public static PauseIconTexture: PIXI.Texture;
|
public static PauseIconTexture: PIXI.Texture;
|
||||||
@ -92,6 +93,7 @@ export default class GameAssets {
|
|||||||
this.Load('./assets/gui/frame_red.png').then((texture) => (this.RedBackground = texture)),
|
this.Load('./assets/gui/frame_red.png').then((texture) => (this.RedBackground = texture)),
|
||||||
this.Load('./assets/gui/frame_green.png').then((texture) => (this.GreenBackground = texture)),
|
this.Load('./assets/gui/frame_green.png').then((texture) => (this.GreenBackground = texture)),
|
||||||
this.Load('./assets/gui/frame_blue.png').then((texture) => (this.BlueBackground = texture)),
|
this.Load('./assets/gui/frame_blue.png').then((texture) => (this.BlueBackground = texture)),
|
||||||
|
this.Load('./assets/gui/gem_frame.png').then((texture) => (this.GemFrame = texture)),
|
||||||
this.Load('./assets/gui/heart.png').then((texture) => (this.HealthTexture = texture)),
|
this.Load('./assets/gui/heart.png').then((texture) => (this.HealthTexture = texture)),
|
||||||
this.Load('./assets/gui/money.png').then((texture) => (this.GoldTexture = texture)),
|
this.Load('./assets/gui/money.png').then((texture) => (this.GoldTexture = texture)),
|
||||||
this.Load('./assets/gui/wave.png').then((texture) => (this.WaveTexture = texture)),
|
this.Load('./assets/gui/wave.png').then((texture) => (this.WaveTexture = texture)),
|
||||||
|
@ -85,7 +85,7 @@ export type GenericGemImprovement = {
|
|||||||
attackSpeedUp: number;
|
attackSpeedUp: number;
|
||||||
rangeUp: number;
|
rangeUp: number;
|
||||||
timeToLiveUp: number;
|
timeToLiveUp: number;
|
||||||
pieceUp: number;
|
pierceUp: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PathDefinition = [[row: number, column: number]];
|
export type PathDefinition = [[row: number, column: number]];
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import * as PIXI from 'pixi.js';
|
import * as PIXI from 'pixi.js';
|
||||||
import { GemType } from '../Definitions';
|
import { GemType } from '../Definitions';
|
||||||
|
import GameAssets from '../Assets';
|
||||||
export default class Gem {
|
export default class Gem {
|
||||||
public texture: PIXI.Texture;
|
public texture: PIXI.Texture;
|
||||||
public type: GemType;
|
public type: GemType;
|
||||||
public level: number = 1;
|
public level: number = 1;
|
||||||
// TODO: create and load from Gems.json and also load gem textures
|
constructor(gemType: GemType) {
|
||||||
constructor(gemType) {}
|
this.texture = GameAssets.Gems[gemType].textures[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,13 +47,16 @@ export class Cell extends GameObject {
|
|||||||
this.container.addChild(this.clickDetector);
|
this.container.addChild(this.clickDetector);
|
||||||
this.container.addChild(this.g);
|
this.container.addChild(this.g);
|
||||||
this.clickDetector.on('pointerup', (e) => {
|
this.clickDetector.on('pointerup', (e) => {
|
||||||
|
if (!Engine.Grid.gridInteractionEnabled) return;
|
||||||
if (Engine.TowerManager.isPlacingTower) Engine.Grid.onGridCellClicked(row, column);
|
if (Engine.TowerManager.isPlacingTower) Engine.Grid.onGridCellClicked(row, column);
|
||||||
else this.OpenSelectedTowerPanel();
|
else this.OpenSelectedTowerPanel();
|
||||||
});
|
});
|
||||||
this.clickDetector.on('pointerenter', (e) => {
|
this.clickDetector.on('pointerenter', (e) => {
|
||||||
|
if (!Engine.Grid.gridInteractionEnabled) return;
|
||||||
Engine.GameScene.events.emit(GridEvents.CellMouseOver, this);
|
Engine.GameScene.events.emit(GridEvents.CellMouseOver, this);
|
||||||
});
|
});
|
||||||
this.clickDetector.on('pointerleave', (e) => {
|
this.clickDetector.on('pointerleave', (e) => {
|
||||||
|
if (!Engine.Grid.gridInteractionEnabled) return;
|
||||||
Engine.GameScene.events.emit(GridEvents.CellMouseLeave, this);
|
Engine.GameScene.events.emit(GridEvents.CellMouseLeave, this);
|
||||||
Engine.Grid.rangePreview.clear();
|
Engine.Grid.rangePreview.clear();
|
||||||
});
|
});
|
||||||
@ -84,8 +87,6 @@ export class Cell extends GameObject {
|
|||||||
if (this.hasTowerPlaced) {
|
if (this.hasTowerPlaced) {
|
||||||
const tower = Engine.TowerManager.GetTowerByRowAndCol(this.row, this.column);
|
const tower = Engine.TowerManager.GetTowerByRowAndCol(this.row, this.column);
|
||||||
Engine.GameScene.towerPanel.Show(tower);
|
Engine.GameScene.towerPanel.Show(tower);
|
||||||
} else {
|
|
||||||
// TODO: hide the sidepanel somehow
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public checkIfCantPlace() {
|
public checkIfCantPlace() {
|
||||||
@ -117,6 +118,7 @@ export class Grid extends GameObject {
|
|||||||
public rangePreview: PIXI.Graphics;
|
public rangePreview: PIXI.Graphics;
|
||||||
public creeps: Creep[] = [];
|
public creeps: Creep[] = [];
|
||||||
public gridShown: boolean = false;
|
public gridShown: boolean = false;
|
||||||
|
public gridInteractionEnabled = true;
|
||||||
|
|
||||||
constructor(map: GameMapDefinition, missionIndex) {
|
constructor(map: GameMapDefinition, missionIndex) {
|
||||||
super();
|
super();
|
||||||
|
@ -124,14 +124,17 @@ export class GameScene extends Scene {
|
|||||||
`Round ${this.currentRound + 1}/${this.mission.rounds.length} completed.`,
|
`Round ${this.currentRound + 1}/${this.mission.rounds.length} completed.`,
|
||||||
'info'
|
'info'
|
||||||
);
|
);
|
||||||
if (this.currentRound == this.mission.rounds.length) {
|
if (this.currentRound + 2 == this.mission.rounds.length) {
|
||||||
Engine.NotificationManager.Notify(`Final round.`, 'danger');
|
Engine.NotificationManager.Notify(`Final round.`, 'danger');
|
||||||
}
|
}
|
||||||
if (this.currentRound + 1 == this.mission.rounds.length) {
|
if (this.currentRound + 1 == this.mission.rounds.length) {
|
||||||
Engine.NotificationManager.Notify(`Mission victory!!`, 'reward');
|
Engine.NotificationManager.Notify(`Mission victory!!`, 'reward');
|
||||||
this.changeRoundButton.buttonIcon.texture = GameAssets.HomeIconTexture;
|
this.changeRoundButton.buttonIcon.texture = GameAssets.HomeIconTexture;
|
||||||
this.playerWon = true;
|
this.playerWon = true;
|
||||||
} else this.currentRound++;
|
} else {
|
||||||
|
this.currentRound++;
|
||||||
|
this.OfferPlayerGems();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.MissionStats.getHP() <= 0) {
|
if (this.MissionStats.getHP() <= 0) {
|
||||||
@ -142,6 +145,11 @@ export class GameScene extends Scene {
|
|||||||
this.ShowScoreScreen(false);
|
this.ShowScoreScreen(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private OfferPlayerGems() {
|
||||||
|
Engine.Grid.gridInteractionEnabled = false;
|
||||||
|
|
||||||
|
Engine.Grid.gridInteractionEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
private ShowScoreScreen(lost) {
|
private ShowScoreScreen(lost) {
|
||||||
// TODO: show to player for real
|
// TODO: show to player for real
|
||||||
|
Loading…
x
Reference in New Issue
Block a user