add Oceania and North America maps

This commit is contained in:
Evan
2024-12-08 20:56:19 -08:00
parent 323e30b875
commit da7637477c
14 changed files with 26760 additions and 410 deletions
+2 -5
View File
@@ -8,7 +8,7 @@ import { TerrainTile } from '../core/game/Game';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const mapName = "Mena"
const mapName = "Oceania"
interface Coord {
x: number;
@@ -40,7 +40,6 @@ export async function loadTerrainMap(): Promise<void> {
let max = 0
let min = 1000
const array: number[] = new Array(256).fill(0);
// Iterate through each pixel
@@ -50,15 +49,13 @@ export async function loadTerrainMap(): Promise<void> {
const alpha = color & 0xff;
const blue = (color >> 8) & 0xff;
if (alpha < 20) { // transparent
if (alpha < 20 || blue == 106) { // transparent
terrain[x][y] = new Terrain(TerrainType.Water);
} else {
terrain[x][y] = new Terrain(TerrainType.Land)
terrain[x][y].magnitude = 0
array[blue]++
// 140 -> 200 = 60
const mag = Math.min(200, Math.max(140, blue)) - 140
terrain[x][y].magnitude = mag / 2