From 149a6b47f947cb6385020ef6e9d28fc81e442ad9 Mon Sep 17 00:00:00 2001 From: Adrian Gaudebert Date: Thu, 7 Nov 2024 11:18:49 +0100 Subject: [PATCH] Add a worldmap showing some oasis regions. --- public/img/icons/world.svg | 1 + src/board/OasisRegion.svelte | 25 +++++++++++++++++++++++++ src/board/Worldmap.svelte | 27 +++++++++++++++++++++++++++ src/data/worldmap.ts | 22 ++++++++++++++++++++++ src/hud/Game.svelte | 3 +++ src/hud/Navigation.svelte | 7 +++++++ src/types.ts | 27 ++++++++++++++++++++++++++- src/village.ts | 16 +++++++++++++++- 8 files changed, 126 insertions(+), 2 deletions(-) create mode 100644 public/img/icons/world.svg create mode 100644 src/board/OasisRegion.svelte create mode 100644 src/board/Worldmap.svelte create mode 100644 src/data/worldmap.ts diff --git a/public/img/icons/world.svg b/public/img/icons/world.svg new file mode 100644 index 0000000..dc13813 --- /dev/null +++ b/public/img/icons/world.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/board/OasisRegion.svelte b/src/board/OasisRegion.svelte new file mode 100644 index 0000000..5c65b6f --- /dev/null +++ b/src/board/OasisRegion.svelte @@ -0,0 +1,25 @@ + + +
+

+ { region.resource } + Oasis + (→ { region.distance }) +

+
+ + +
+
+ + diff --git a/src/board/Worldmap.svelte b/src/board/Worldmap.svelte new file mode 100644 index 0000000..0c8d33d --- /dev/null +++ b/src/board/Worldmap.svelte @@ -0,0 +1,27 @@ + + +
+ { #each $village.worldmap as region } +
+ { #if region.type === 'oasis' } + + { /if } +
+ { /each } +
+ + diff --git a/src/data/worldmap.ts b/src/data/worldmap.ts new file mode 100644 index 0000000..e030041 --- /dev/null +++ b/src/data/worldmap.ts @@ -0,0 +1,22 @@ +export default [ + { + type: 'oasis', + resource: 'food', + distance: 1, + }, + { + type: 'oasis', + resource: 'wood', + distance: 1, + }, + { + type: 'oasis', + resource: 'stone', + distance: 1, + }, + { + type: 'oasis', + resource: 'iron', + distance: 1, + }, +]; diff --git a/src/hud/Game.svelte b/src/hud/Game.svelte index bd9f493..f2ec241 100644 --- a/src/hud/Game.svelte +++ b/src/hud/Game.svelte @@ -3,6 +3,7 @@ import Outside from "../board/Outside.svelte"; import Village from "../board/Village.svelte"; + import Worldmap from "../board/Worldmap.svelte"; import gameTab from "../stores/gameTab"; import type { GameTab } from "../types"; import update from "../update"; @@ -44,6 +45,8 @@ { :else if $gameTab === 'resources' } + { :else if $gameTab === 'world' } + { /if } diff --git a/src/hud/Navigation.svelte b/src/hud/Navigation.svelte index e33bf9d..3082720 100644 --- a/src/hud/Navigation.svelte +++ b/src/hud/Navigation.svelte @@ -19,6 +19,13 @@ Resources +