feat: Enhance level 1 with expanded map size, updated tile data, improved enemy spawning, refined UI interactions and adjusted wave configurations
- Expanded level 1 map from 9x16 to 13x16 tiles with updated collision data - Modified enemy spawn timing ranges for more varied gameplay - Adjusted interface animations and tower placement logic - Updated wave configurations including new wave 3 with increased difficulty - Disabled zoom controls and removed right-click tower deletion functionality The changes aim to provide a larger playable area, improve game balance through better enemy distribution, enhance user interface responsiveness, and increase challenge progression across waves.
This commit is contained in:
parent
1233c2bf76
commit
aa8cabc90f
|
|
@ -1,73 +1,49 @@
|
||||||
{ "compressionlevel":-1,
|
{ "compressionlevel":-1,
|
||||||
"height":9,
|
"height":13,
|
||||||
"infinite":true,
|
"infinite":false,
|
||||||
"layers":[
|
"layers":[
|
||||||
{
|
{
|
||||||
"chunks":[
|
"data":[2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 12, 0, 0,
|
||||||
{
|
2, 1, 2, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 12, 0, 0,
|
||||||
"data":[2, 1, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0,
|
2, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 2, 12, 0, 0,
|
||||||
2, 1, 2, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0,
|
2, 2, 2, 2, 2, 2, 1, 2, 2, 1, 2, 2, 2, 12, 0, 0,
|
||||||
2, 1, 1, 1, 2, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0,
|
2, 2, 2, 2, 2, 2, 1, 2, 2, 1, 2, 2, 2, 12, 0, 0,
|
||||||
2, 2, 2, 2, 2, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0,
|
2, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 2, 12, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 12, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
2, 1, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 2, 12, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
2, 1, 2, 1, 2, 2, 1, 1, 2, 2, 2, 1, 2, 12, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
2, 1, 2, 1, 2, 2, 2, 1, 1, 1, 1, 1, 2, 12, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
2, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 12, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 12, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
2684354572, 2684354572, 2684354572, 2684354572, 2684354572, 2684354572, 2684354572, 2684354572, 2684354572, 2684354572, 2684354572, 2684354572, 2684354572, 2684354572, 0, 0],
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
"height":13,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
||||||
"height":16,
|
|
||||||
"width":16,
|
|
||||||
"x":0,
|
|
||||||
"y":0
|
|
||||||
}],
|
|
||||||
"height":16,
|
|
||||||
"id":1,
|
"id":1,
|
||||||
"name":"main",
|
"name":"main",
|
||||||
"opacity":1,
|
"opacity":1,
|
||||||
"startx":0,
|
|
||||||
"starty":0,
|
|
||||||
"type":"tilelayer",
|
"type":"tilelayer",
|
||||||
"visible":true,
|
"visible":true,
|
||||||
"width":16,
|
"width":16,
|
||||||
"x":0,
|
"x":0,
|
||||||
"y":0
|
"y":0
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"chunks":[
|
|
||||||
{
|
{
|
||||||
"data":[0, 0, 16, 0, 16, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
"data":[0, 0, 16, 0, 16, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 16, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 16, 0, 0, 0, 16, 0, 0, 0, 16, 0, 0, 0, 0, 0,
|
||||||
16, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
16, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 16, 16, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 16, 16, 0, 16, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 16, 16, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 16, 0, 0, 16, 0, 0, 0, 0, 16, 0, 16, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
16, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 16, 0, 16, 16, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 16, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
"height":16,
|
"height":13,
|
||||||
"width":16,
|
|
||||||
"x":0,
|
|
||||||
"y":0
|
|
||||||
}],
|
|
||||||
"height":16,
|
|
||||||
"id":2,
|
"id":2,
|
||||||
"name":"platforms",
|
"name":"platforms",
|
||||||
"opacity":1,
|
"opacity":1,
|
||||||
"startx":0,
|
|
||||||
"starty":0,
|
|
||||||
"type":"tilelayer",
|
"type":"tilelayer",
|
||||||
"visible":true,
|
"visible":true,
|
||||||
"width":16,
|
"width":16,
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 213 KiB After Width: | Height: | Size: 360 KiB |
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<map version="1.10" tiledversion="1.11.2" orientation="orthogonal" renderorder="right-down" width="16" height="9" tilewidth="200" tileheight="200" infinite="1" nextlayerid="3" nextobjectid="1">
|
<map version="1.10" tiledversion="1.11.2" orientation="orthogonal" renderorder="right-down" width="16" height="13" tilewidth="200" tileheight="200" infinite="0" nextlayerid="3" nextobjectid="1">
|
||||||
<editorsettings>
|
<editorsettings>
|
||||||
<export target="../level1.json" format="json"/>
|
<export target="../level1.json" format="json"/>
|
||||||
</editorsettings>
|
</editorsettings>
|
||||||
|
|
@ -11,48 +11,38 @@
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
</tileset>
|
</tileset>
|
||||||
<layer id="1" name="main" width="16" height="9">
|
<layer id="1" name="main" width="16" height="13">
|
||||||
<data encoding="csv">
|
<data encoding="csv">
|
||||||
<chunk x="0" y="0" width="16" height="16">
|
2,1,2,2,2,2,2,2,2,2,2,2,2,12,0,0,
|
||||||
2,1,2,2,2,2,2,2,0,0,0,0,0,0,0,0,
|
2,1,2,1,1,1,2,2,2,2,2,2,2,12,0,0,
|
||||||
2,1,2,1,1,1,2,2,0,0,0,0,0,0,0,0,
|
2,1,1,1,2,1,1,2,2,1,1,1,2,12,0,0,
|
||||||
2,1,1,1,2,1,1,2,0,0,0,0,0,0,0,0,
|
2,2,2,2,2,2,1,2,2,1,2,2,2,12,0,0,
|
||||||
2,2,2,2,2,2,1,2,0,0,0,0,0,0,0,0,
|
2,2,2,2,2,2,1,2,2,1,2,2,2,12,0,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
2,1,1,1,1,1,1,2,2,1,1,1,2,12,0,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
2,1,2,2,2,2,2,2,2,2,2,1,2,12,0,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
2,1,2,1,1,1,1,2,2,2,2,1,2,12,0,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
2,1,2,1,2,2,1,1,2,2,2,1,2,12,0,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
2,1,2,1,2,2,2,1,1,1,1,1,2,12,0,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
2,1,1,1,2,2,2,2,2,2,2,2,2,12,0,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
2,2,2,2,2,2,2,2,2,2,2,2,2,12,0,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
2684354572,2684354572,2684354572,2684354572,2684354572,2684354572,2684354572,2684354572,2684354572,2684354572,2684354572,2684354572,2684354572,2684354572,0,0
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
</data>
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
|
||||||
</chunk>
|
|
||||||
</data>
|
|
||||||
</layer>
|
</layer>
|
||||||
<layer id="2" name="platforms" width="16" height="9">
|
<layer id="2" name="platforms" width="16" height="13">
|
||||||
<data encoding="csv">
|
<data encoding="csv">
|
||||||
<chunk x="0" y="0" width="16" height="16">
|
|
||||||
0,0,16,0,16,0,16,0,0,0,0,0,0,0,0,0,
|
0,0,16,0,16,0,16,0,0,0,0,0,0,0,0,0,
|
||||||
0,0,16,0,0,0,16,0,0,0,0,0,0,0,0,0,
|
0,0,16,0,0,0,16,0,0,0,16,0,0,0,0,0,
|
||||||
16,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,
|
16,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
0,16,16,0,16,0,0,0,0,0,0,0,0,0,0,0,
|
0,16,16,0,16,0,0,0,16,0,0,0,0,0,0,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
0,0,0,16,0,0,0,0,0,0,16,16,0,0,0,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
0,0,16,0,0,16,0,0,0,0,16,0,16,0,0,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
16,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
0,0,16,0,16,16,0,0,0,0,16,0,0,0,0,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
0,0,0,0,0,0,0,0,16,0,0,16,0,0,0,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||||
</chunk>
|
</data>
|
||||||
</data>
|
|
||||||
</layer>
|
</layer>
|
||||||
</map>
|
</map>
|
||||||
|
|
|
||||||
|
|
@ -57,23 +57,23 @@ export class Level extends Phaser.Scene {
|
||||||
}
|
}
|
||||||
|
|
||||||
addControls() {
|
addControls() {
|
||||||
this.input.on('wheel', (pointer, gameObjects, deltaX, deltaY) => {
|
// this.input.on('wheel', (pointer, gameObjects, deltaX, deltaY) => {
|
||||||
const zoomSpeed = 0.1;
|
// const zoomSpeed = 0.1;
|
||||||
if (deltaY < 0) {
|
// if (deltaY < 0) {
|
||||||
// Zoom in
|
// // Zoom in
|
||||||
this.cameras.main.zoom += zoomSpeed;
|
// this.cameras.main.zoom += zoomSpeed;
|
||||||
} else if (deltaY > 0) {
|
// } else if (deltaY > 0) {
|
||||||
// Zoom out
|
// // Zoom out
|
||||||
this.cameras.main.zoom -= zoomSpeed;
|
// this.cameras.main.zoom -= zoomSpeed;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Limit zoom range to prevent extreme zoom levels
|
// // Limit zoom range to prevent extreme zoom levels
|
||||||
this.cameras.main.zoom = Phaser.Math.Clamp(this.cameras.main.zoom, 0.5, 2);
|
// this.cameras.main.zoom = Phaser.Math.Clamp(this.cameras.main.zoom, 0.5, 2);
|
||||||
|
|
||||||
// Zoom toward mouse position
|
// // Zoom toward mouse position
|
||||||
const worldPoint = this.input.activePointer.positionToCamera(this.cameras.main);
|
// const worldPoint = this.input.activePointer.positionToCamera(this.cameras.main);
|
||||||
this.cameras.main.centerOn(worldPoint.x, worldPoint.y);
|
// this.cameras.main.centerOn(worldPoint.x, worldPoint.y);
|
||||||
});
|
// });
|
||||||
|
|
||||||
// Add camera panning functionality
|
// Add camera panning functionality
|
||||||
this.input.on('pointerdown', (pointer) => {
|
this.input.on('pointerdown', (pointer) => {
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,10 @@ export class Enemies {
|
||||||
this.speedLow = ENEMIES_CONFIG[type].speedLow;
|
this.speedLow = ENEMIES_CONFIG[type].speedLow;
|
||||||
this.speedHigh = ENEMIES_CONFIG[type].speedHigh;
|
this.speedHigh = ENEMIES_CONFIG[type].speedHigh;
|
||||||
this.baseSprite = ENEMIES_CONFIG[type].spriteStart;
|
this.baseSprite = ENEMIES_CONFIG[type].spriteStart;
|
||||||
|
this.spawnRange = {
|
||||||
|
low: 500,
|
||||||
|
high: 4000
|
||||||
|
}
|
||||||
|
|
||||||
this.spawnEnemy();
|
this.spawnEnemy();
|
||||||
}
|
}
|
||||||
|
|
@ -24,7 +28,7 @@ export class Enemies {
|
||||||
const spawnY = (this.y * 200) + 100 + randY;
|
const spawnY = (this.y * 200) + 100 + randY;
|
||||||
|
|
||||||
// Randomize Spawn Time a bit
|
// Randomize Spawn Time a bit
|
||||||
this.scene.time.delayedCall(Phaser.Math.Between(0,2000), () => {
|
this.scene.time.delayedCall(Phaser.Math.Between(this.spawnRange.low, this.spawnRange.high), () => {
|
||||||
// Create enemy and store reference
|
// Create enemy and store reference
|
||||||
const enemy = this.scene.add.sprite(spawnX, spawnY, ENEMIES_CONFIG[this.type].spriteSheet, ENEMIES_CONFIG[this.type].spriteStart);
|
const enemy = this.scene.add.sprite(spawnX, spawnY, ENEMIES_CONFIG[this.type].spriteSheet, ENEMIES_CONFIG[this.type].spriteStart);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ export class InterfaceManager {
|
||||||
|
|
||||||
constructor(scene) {
|
constructor(scene) {
|
||||||
this.scene = scene;
|
this.scene = scene;
|
||||||
this.gold = 100;
|
this.gold = 150;
|
||||||
this.cores = 20;
|
this.cores = 20;
|
||||||
this.interfaceOpen = false;
|
this.interfaceOpen = false;
|
||||||
this.selectedTower = false;
|
this.selectedTower = false;
|
||||||
|
|
@ -56,15 +56,15 @@ export class InterfaceManager {
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: this.intTop,
|
targets: this.intTop,
|
||||||
y: 50,
|
y: 50,
|
||||||
duration: 2000,
|
duration: 500,
|
||||||
delay: 2000,
|
delay: 500,
|
||||||
ease: 'Back.easeOut',
|
ease: 'Back.easeOut',
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: [this.coreText, this.goldText, this.intCore],
|
targets: [this.coreText, this.goldText, this.intCore],
|
||||||
angle: 360,
|
angle: 360,
|
||||||
alpha: 1,
|
alpha: 1,
|
||||||
duration: 1000,
|
duration: 500,
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: this.intCore,
|
targets: this.intCore,
|
||||||
|
|
@ -103,14 +103,14 @@ export class InterfaceManager {
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: this.intMain,
|
targets: this.intMain,
|
||||||
y: 1150,
|
y: 1150,
|
||||||
duration: 2000,
|
duration: 500,
|
||||||
delay: 2000,
|
delay: 500,
|
||||||
ease: 'Back.easeOut',
|
ease: 'Back.easeOut',
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: [this.interfaceText, this.upLeft, this.upRight],
|
targets: [this.interfaceText, this.upLeft, this.upRight],
|
||||||
alpha: 1,
|
alpha: 1,
|
||||||
duration: 1000,
|
duration: 500,
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: [this.upLeft, this.upRight],
|
targets: [this.upLeft, this.upRight],
|
||||||
|
|
@ -266,7 +266,7 @@ export class InterfaceManager {
|
||||||
.setOrigin(0.5)
|
.setOrigin(0.5)
|
||||||
.setScrollFactor(0);
|
.setScrollFactor(0);
|
||||||
slot.add(slotBack);
|
slot.add(slotBack);
|
||||||
slotBack.setInteractive();
|
//slotBack.setInteractive();
|
||||||
slotBack.on('pointerdown', () => {
|
slotBack.on('pointerdown', () => {
|
||||||
this.selectTower(type);
|
this.selectTower(type);
|
||||||
});
|
});
|
||||||
|
|
@ -384,9 +384,10 @@ export class InterfaceManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Snap to current mouse position
|
// Snap to current mouse position
|
||||||
|
const levelCam = this.scene.levelScene.cameras.main;
|
||||||
const mouse = this.scene.input.activePointer;
|
const mouse = this.scene.input.activePointer;
|
||||||
const worldX = mouse.worldX;
|
const worldX = mouse.position.x + levelCam.scrollX;
|
||||||
const worldY = mouse.worldY;
|
const worldY = mouse.position.y + levelCam.scrollY;
|
||||||
|
|
||||||
// Convert world coordinates to tile coordinates
|
// Convert world coordinates to tile coordinates
|
||||||
const tileX = Math.floor(worldX / 200); // Assuming 200px tile width
|
const tileX = Math.floor(worldX / 200); // Assuming 200px tile width
|
||||||
|
|
@ -405,9 +406,10 @@ export class InterfaceManager {
|
||||||
update(time, delta) {
|
update(time, delta) {
|
||||||
if (this.selectedTower) {
|
if (this.selectedTower) {
|
||||||
// Snap to current mouse position
|
// Snap to current mouse position
|
||||||
|
const levelCam = this.scene.levelScene.cameras.main;
|
||||||
const mouse = this.scene.input.activePointer;
|
const mouse = this.scene.input.activePointer;
|
||||||
const worldX = mouse.worldX;
|
const worldX = mouse.position.x + levelCam.scrollX;
|
||||||
const worldY = mouse.worldY;
|
const worldY = mouse.position.y + levelCam.scrollY;
|
||||||
|
|
||||||
// Convert world coordinates to tile coordinates
|
// Convert world coordinates to tile coordinates
|
||||||
const tileX = Math.floor(worldX / 200); // Assuming 200px tile width
|
const tileX = Math.floor(worldX / 200); // Assuming 200px tile width
|
||||||
|
|
@ -418,9 +420,10 @@ export class InterfaceManager {
|
||||||
x: tileX,
|
x: tileX,
|
||||||
y: tileY
|
y: tileY
|
||||||
};
|
};
|
||||||
|
|
||||||
// Convert back to world position for proper snapping
|
// Convert back to world position for proper snapping
|
||||||
const snappedX = tileX * 200 + 100; // Center the tower on the tile (assuming 200px tiles)
|
const snappedX = tileX * 200 + 100 - levelCam.scrollX; // Center the tower on the tile (assuming 200px tiles)
|
||||||
const snappedY = tileY * 200 + 100;
|
const snappedY = tileY * 200 + 100 - levelCam.scrollY;
|
||||||
|
|
||||||
this.selectedTower.setPosition(snappedX, snappedY);
|
this.selectedTower.setPosition(snappedX, snappedY);
|
||||||
|
|
||||||
|
|
@ -444,11 +447,6 @@ export class InterfaceManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mouse.rightButtonDown()) {
|
|
||||||
this.selectedTower.destroy();
|
|
||||||
this.selectedTower = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4,8 +4,8 @@ export const WAVE_CONFIG = {
|
||||||
//Spawn Point
|
//Spawn Point
|
||||||
spawnX: 1,
|
spawnX: 1,
|
||||||
spawnY: 0,
|
spawnY: 0,
|
||||||
endX: 6,
|
endX: 11,
|
||||||
endY: 3,
|
endY: 2,
|
||||||
// Wave
|
// Wave
|
||||||
1: {
|
1: {
|
||||||
// Schedule
|
// Schedule
|
||||||
|
|
@ -40,6 +40,22 @@ export const WAVE_CONFIG = {
|
||||||
basic1: 5,
|
basic1: 5,
|
||||||
basic2: 4
|
basic2: 4
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
// Wave
|
||||||
|
3: {
|
||||||
|
// Schedule
|
||||||
|
1: {
|
||||||
|
begin: 0,
|
||||||
|
basic2: 5
|
||||||
|
},
|
||||||
|
2: {
|
||||||
|
begin: 15,
|
||||||
|
basic2: 6
|
||||||
|
},
|
||||||
|
3: {
|
||||||
|
begin: 30,
|
||||||
|
basic2: 8
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -150,7 +150,7 @@ export class WaveManager {
|
||||||
this.waveTimer += delta;
|
this.waveTimer += delta;
|
||||||
|
|
||||||
if (this.waveTimer >= this.waveStart && this.levelActive === true && this.waveActive===true) {
|
if (this.waveTimer >= this.waveStart && this.levelActive === true && this.waveActive===true) {
|
||||||
console.log('Wave',this.wave,'Schedule',this.schedule);
|
//console.log('Wave',this.wave,'Schedule',this.schedule);
|
||||||
// Make path synchronous
|
// Make path synchronous
|
||||||
this.makePath().then(() => {
|
this.makePath().then(() => {
|
||||||
// Spawn enemies after path is ready
|
// Spawn enemies after path is ready
|
||||||
|
|
@ -172,13 +172,13 @@ export class WaveManager {
|
||||||
|
|
||||||
spawnSchedule() {
|
spawnSchedule() {
|
||||||
if (this.scheduleInfo.hasOwnProperty('basic1')) {
|
if (this.scheduleInfo.hasOwnProperty('basic1')) {
|
||||||
console.log('Spawn',this.scheduleInfo.basic1,'Basic1 enemies');
|
//console.log('Spawn',this.scheduleInfo.basic1,'Basic1 enemies');
|
||||||
for (let e = 0; e < this.scheduleInfo.basic1; e++) {
|
for (let e = 0; e < this.scheduleInfo.basic1; e++) {
|
||||||
const enemy = new Enemies(this.scene, 'basic1', this.spawnX, this.spawnY, this.path);
|
const enemy = new Enemies(this.scene, 'basic1', this.spawnX, this.spawnY, this.path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.scheduleInfo.hasOwnProperty('basic2')) {
|
if (this.scheduleInfo.hasOwnProperty('basic2')) {
|
||||||
console.log('Spawn',this.scheduleInfo.basic2,'Basic2 enemies');
|
//console.log('Spawn',this.scheduleInfo.basic2,'Basic2 enemies');
|
||||||
for (let e = 0; e < this.scheduleInfo.basic2; e++) {
|
for (let e = 0; e < this.scheduleInfo.basic2; e++) {
|
||||||
const enemy = new Enemies(this.scene, 'basic2', this.spawnX, this.spawnY, this.path);
|
const enemy = new Enemies(this.scene, 'basic2', this.spawnX, this.spawnY, this.path);
|
||||||
}
|
}
|
||||||
|
|
@ -193,7 +193,7 @@ export class WaveManager {
|
||||||
const width = this.scene.levelMap.width;
|
const width = this.scene.levelMap.width;
|
||||||
const height = this.scene.levelMap.height;
|
const height = this.scene.levelMap.height;
|
||||||
const grid = [];
|
const grid = [];
|
||||||
|
console.log('width', width, 'height', height);
|
||||||
// Create a grid based on collision data
|
// Create a grid based on collision data
|
||||||
for (let y = 0; y < height; y++) {
|
for (let y = 0; y < height; y++) {
|
||||||
grid[y] = [];
|
grid[y] = [];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue