diff --git a/src/components/World.vue b/src/components/World.vue index dc8b6fc..a2cf579 100644 --- a/src/components/World.vue +++ b/src/components/World.vue @@ -11,7 +11,7 @@ :texture="item.object.id" :originY="Number(item.object.origin_x)" :originX="Number(item.object.origin_y)" - :depth="item.depth" + :depth="(item.depth > 0 ? item.depth : undefined)" /> diff --git a/src/components/utilities/zoneEditor/ZoneEditor.vue b/src/components/utilities/zoneEditor/ZoneEditor.vue index 585b9ac..2b633eb 100644 --- a/src/components/utilities/zoneEditor/ZoneEditor.vue +++ b/src/components/utilities/zoneEditor/ZoneEditor.vue @@ -12,7 +12,7 @@ :texture="object.object.id" :originY="Number(object.object.origin_x)" :originX="Number(object.object.origin_y)" - :depth="object.depth ?? calculateDepth(object.position_x, object.position_y, zoneTilemap.width)" + :depth="object.depth > 0 ? object.depth : undefined" @pointerup="() => zoneEditorStore.setSelectedZoneObject(object)" /> @@ -22,17 +22,18 @@ - + + diff --git a/src/screens/Game.vue b/src/screens/Game.vue index 3cc34dc..16a987b 100644 --- a/src/screens/Game.vue +++ b/src/screens/Game.vue @@ -131,7 +131,7 @@ const preloadScene = (scene: Phaser.Scene) => { }) scene.load.image('BLOCK', '/assets/zone/bt_tile.png') - scene.load.image('WARP', '/assets/zone/tp_tile.png') + scene.load.image('TELEPORT', '/assets/zone/tp_tile.png') scene.load.image('blank_tile', '/assets/zone/blank_tile.png') scene.load.image('blank_object', '/assets/zone/blank_tile.png') scene.load.image('waypoint', '/assets/waypoint.png') diff --git a/src/services/zone.ts b/src/services/zone.ts index f90a106..82a8bd1 100644 --- a/src/services/zone.ts +++ b/src/services/zone.ts @@ -86,7 +86,7 @@ export const updateZoneTiles = (zoneTilemap: Tilemap, tiles: Phaser.Tilemaps.Til } // Update the tilemap with any new 'blank_tile' entries - zoneTiles.forEach((row, y) => { + zoneTiles.forEach((row: string[], y: number) => { row.forEach((tileId, x) => { placeTile(zoneTilemap, tiles, x, y, tileId) }) diff --git a/src/stores/zoneEditor.ts b/src/stores/zoneEditor.ts index 6f3582c..4dc87c2 100644 --- a/src/stores/zoneEditor.ts +++ b/src/stores/zoneEditor.ts @@ -2,6 +2,12 @@ import { defineStore } from 'pinia' import { useGameStore } from '@/stores/game' import type { Zone, Object, Tile, ZoneObject } from '@/types' +type TeleportSettings = { + x: number + y: number + zoneId: number +} + export const useZoneEditorStore = defineStore('zoneEditor', { state: () => ({ active: false, @@ -20,7 +26,12 @@ export const useZoneEditorStore = defineStore('zoneEditor', { isObjectListModalShown: false, isZoneListModalShown: false, isCreateZoneModalShown: false, - isSettingsModalShown: false + isSettingsModalShown: false, + teleportSettings: { + x: 0, + y: 0, + zoneId: 0 + } }), actions: { toggleActive() { @@ -93,6 +104,9 @@ export const useZoneEditorStore = defineStore('zoneEditor', { toggleCreateZoneModal() { this.isCreateZoneModalShown = !this.isCreateZoneModalShown }, + setTeleportSettings(teleportSettings: TeleportSettings) { + this.teleportSettings = teleportSettings + }, reset() { this.zoneList = [] this.tileList = [] diff --git a/src/types.ts b/src/types.ts index cda9808..6cce59b 100644 --- a/src/types.ts +++ b/src/types.ts @@ -72,7 +72,7 @@ export type ZoneObject = { export enum ZoneEventTileType { BLOCK = 'BLOCK', - WARP = 'WARP', + TELEPORT = 'TELEPORT', NPC = 'NPC', ITEM = 'ITEM' }