forked from noxious/client
Fully restored tile picker function
This commit is contained in:
parent
6bede8c44e
commit
517e92b07b
@ -74,7 +74,7 @@ function pencil(pointer: Phaser.Input.Pointer) {
|
|||||||
placeTile(tileMap.value, tileLayer.value, tile.x, tile.y, mapEditor.selectedTile.value)
|
placeTile(tileMap.value, tileLayer.value, tile.x, tile.y, mapEditor.selectedTile.value)
|
||||||
|
|
||||||
// Adjust mapEditorStore.map.tiles
|
// Adjust mapEditorStore.map.tiles
|
||||||
map.tiles[tile.y][tile.x] = map.tiles[tile.y][tile.x]
|
map.tiles[tile.y][tile.x] = mapEditor.selectedTile.value
|
||||||
}
|
}
|
||||||
|
|
||||||
function eraser(pointer: Phaser.Input.Pointer) {
|
function eraser(pointer: Phaser.Input.Pointer) {
|
||||||
@ -111,15 +111,12 @@ function tilePicker(pointer: Phaser.Input.Pointer) {
|
|||||||
let map = mapEditor.currentMap.value
|
let map = mapEditor.currentMap.value
|
||||||
if (!map) return
|
if (!map) return
|
||||||
|
|
||||||
console.log("herer")
|
|
||||||
if (!tileMap.value || !tileLayer.value) return
|
if (!tileMap.value || !tileLayer.value) return
|
||||||
|
|
||||||
// Check if there is a tile
|
// Check if there is a tile
|
||||||
const tile = getTile(tileLayer.value, pointer.worldX, pointer.worldY)
|
const tile = getTile(tileLayer.value, pointer.worldX, pointer.worldY)
|
||||||
if (!tile) return
|
if (!tile) return
|
||||||
|
|
||||||
console.log(tile.index)
|
|
||||||
|
|
||||||
// Select the tile
|
// Select the tile
|
||||||
mapEditor.setSelectedTile(map.tiles[tile.y][tile.x])
|
mapEditor.setSelectedTile(map.tiles[tile.y][tile.x])
|
||||||
}
|
}
|
||||||
@ -137,12 +134,8 @@ watch(
|
|||||||
)
|
)
|
||||||
|
|
||||||
function handlePointer(pointer: Phaser.Input.Pointer) {
|
function handlePointer(pointer: Phaser.Input.Pointer) {
|
||||||
|
|
||||||
if (!tileMap.value || !tileLayer.value) return
|
if (!tileMap.value || !tileLayer.value) return
|
||||||
|
|
||||||
// Check if tool is pencil
|
|
||||||
if (mapEditor.drawMode.value !== 'tile') return
|
|
||||||
|
|
||||||
// Check if left mouse button is pressed
|
// Check if left mouse button is pressed
|
||||||
if (!pointer.isDown) return
|
if (!pointer.isDown) return
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user