updated mission_01 to match defintions.ts
This commit is contained in:
parent
1d2473dae8
commit
bc5878b6d3
@ -1,51 +1,56 @@
|
|||||||
{
|
{
|
||||||
"name": "Mission 1",
|
"name": "Mission 1",
|
||||||
"description": "This is the first mission",
|
"description": "This is the first mission",
|
||||||
"gameMap": {
|
"gameMap": {
|
||||||
"rows": 10,
|
"rows": 10,
|
||||||
"columns": 10,
|
"columns": 10,
|
||||||
"cells": [
|
"cells": [
|
||||||
[1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
|
[1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
|
||||||
[1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
|
[1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
|
||||||
[1, 1, 1, 1, 1, 1, 1, 1, 0, 1],
|
[1, 1, 1, 1, 1, 1, 1, 1, 0, 1],
|
||||||
[1, 1, 1, 1, 1, 0, 0, 0, 1, 1],
|
[1, 1, 1, 1, 1, 0, 0, 0, 1, 1],
|
||||||
[1, 1, 1, 1, 1, 0, 0, 1, 1, 1],
|
[1, 1, 1, 1, 1, 0, 0, 1, 1, 1],
|
||||||
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
||||||
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
||||||
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
||||||
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
||||||
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
|
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
|
||||||
],
|
],
|
||||||
"paths": [
|
"paths": [
|
||||||
[
|
[
|
||||||
[0, 2],
|
[0, 2],
|
||||||
[1, 2],
|
[1, 2],
|
||||||
[2, 2],
|
[2, 2],
|
||||||
[3, 2],
|
[3, 2],
|
||||||
[4, 2],
|
[4, 2],
|
||||||
[5, 2],
|
[5, 2],
|
||||||
[6, 2],
|
[6, 2],
|
||||||
[7, 2],
|
[7, 2],
|
||||||
[8, 2],
|
[8, 2],
|
||||||
[9, 2]
|
[9, 2]
|
||||||
]
|
]
|
||||||
],
|
]
|
||||||
"waves": [
|
},
|
||||||
{
|
"rounds": [
|
||||||
"firstCreepSpawnTick": 120,
|
{
|
||||||
"spawnIntervalTicks": 60,
|
"waves": [
|
||||||
"creeps": [0, 0, 0, 0, 0, 1, 1, 1, 0]
|
{
|
||||||
},
|
"firstCreepSpawnTick": 120,
|
||||||
{
|
"spawnIntervalTicks": 60,
|
||||||
"firstCreepSpawnTick": 480,
|
"creeps": [0, 0, 0, 0, 0, 1, 1, 1, 0]
|
||||||
"spawnIntervalTicks": 60,
|
},
|
||||||
"creeps": [0, 0, 0, 0, 0, 1, 1, 1, 0]
|
{
|
||||||
},
|
"firstCreepSpawnTick": 480,
|
||||||
{
|
"spawnIntervalTicks": 60,
|
||||||
"firstCreepSpawnTick": 480,
|
"creeps": [0, 0, 0, 0, 0, 1, 1, 1, 0]
|
||||||
"spawnIntervalTicks": 60,
|
},
|
||||||
"creeps": [0, 0, 0, 0, 0, 1, 1, 1, 0]
|
{
|
||||||
}
|
"firstCreepSpawnTick": 480,
|
||||||
|
"spawnIntervalTicks": 60,
|
||||||
|
"creeps": [0, 0, 0, 0, 0, 1, 1, 1, 0]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"offeredGems": [0, 1, 2, 3]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ export type MissionDefinition = {
|
|||||||
description: string;
|
description: string;
|
||||||
mapImageUrl: string;
|
mapImageUrl: string;
|
||||||
gameMap: GameMapDefinition;
|
gameMap: GameMapDefinition;
|
||||||
|
missionRounds: MissionRoundDefinition[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type GameMapDefinition = {
|
export type GameMapDefinition = {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import GameObject from '../base/GameObject';
|
import GameObject from '../base/GameObject';
|
||||||
import * as PIXI from 'pixi.js';
|
import * as PIXI from 'pixi.js';
|
||||||
|
|
||||||
export class Creep extends GameObject {
|
export default class Creep extends GameObject {
|
||||||
constructor(bounds?: PIXI.Rectangle) {
|
constructor(bounds?: PIXI.Rectangle) {
|
||||||
super(bounds);
|
super(bounds);
|
||||||
}
|
}
|
||||||
|
13
src/components/WaveManger.ts
Normal file
13
src/components/WaveManger.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import Creep from './Creep';
|
||||||
|
|
||||||
|
export default class WaveManager {
|
||||||
|
// Doesn't need to extend GameObject since it does not render
|
||||||
|
private totalWaves: number;
|
||||||
|
private currentWave: number;
|
||||||
|
private creeps: Creep[];
|
||||||
|
private spawnIntervalTicks: number;
|
||||||
|
private firstCreepSpawnTick: number;
|
||||||
|
constructor(totalWaves) {
|
||||||
|
this.totalWaves = totalWaves;
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,7 @@ import Button from '../base/Button';
|
|||||||
import { MissionDefinition } from '../base/Definitions';
|
import { MissionDefinition } from '../base/Definitions';
|
||||||
import { Grid } from '../components/Grid';
|
import { Grid } from '../components/Grid';
|
||||||
import MissionStats from '../components/MissionStats';
|
import MissionStats from '../components/MissionStats';
|
||||||
|
import WaveManager from '../components/WaveManger';
|
||||||
import SceneBase from './SceneBase';
|
import SceneBase from './SceneBase';
|
||||||
import * as PIXI from 'pixi.js';
|
import * as PIXI from 'pixi.js';
|
||||||
|
|
||||||
@ -9,6 +10,7 @@ export default class GameScene extends SceneBase {
|
|||||||
private ticker: PIXI.Ticker;
|
private ticker: PIXI.Ticker;
|
||||||
private stats: MissionStats;
|
private stats: MissionStats;
|
||||||
private grid: Grid;
|
private grid: Grid;
|
||||||
|
private WaveManager: WaveManager;
|
||||||
|
|
||||||
constructor(mission: MissionDefinition, bounds: PIXI.Rectangle) {
|
constructor(mission: MissionDefinition, bounds: PIXI.Rectangle) {
|
||||||
super(bounds);
|
super(bounds);
|
||||||
@ -20,6 +22,7 @@ export default class GameScene extends SceneBase {
|
|||||||
this.ticker.start();
|
this.ticker.start();
|
||||||
this.stats = new MissionStats(100, 200);
|
this.stats = new MissionStats(100, 200);
|
||||||
this.grid = new Grid(mission.gameMap);
|
this.grid = new Grid(mission.gameMap);
|
||||||
|
this.WaveManager = new WaveManager(mission);
|
||||||
this.draw();
|
this.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user