Worked on pathfinding, character animation & rotation, few enhancements

This commit is contained in:
2024-07-29 09:01:35 +02:00
parent 56d513021f
commit ea29b6f3a2
9 changed files with 49 additions and 48 deletions

View File

@ -6,14 +6,14 @@
<label class="mb-1.5 font-titles" for="name">Name</label>
<input v-model="spriteName" class="input-cyan" type="text" name="name" placeholder="New sprite" />
</div>
<div class="w-full flex gap-2 mt-2 pb-4 relative">
<button class="btn-cyan px-4 py-2 flex-1 sm:flex-none sm:min-w-24" type="button" @click.prevent="saveSprite">Save</button>
<button class="btn-bordeaux px-4 py-2 flex-1 sm:flex-none sm:min-w-24" type="button" @click.prevent="removeSprite">Remove</button>
<div class="w-[calc(100%_+_32px)] absolute left-[-15px] bottom-0 h-px bg-cyan-200"></div>
</div>
</div>
<button class="btn-cyan py-2 my-4" type="button" @click.prevent="addNewImage">New action</button>
<Accordion v-for="action in spriteActions" :key="action.id">
<template #header>
@ -118,19 +118,20 @@ function saveSprite() {
const updatedSprite = {
id: selectedSprite.value.id,
name: spriteName.value,
spriteActions: spriteActions.value?.map((action) => {
return {
action: action.action,
sprites: action.sprites,
origin_x: action.origin_x,
origin_y: action.origin_y,
isAnimated: action.isAnimated,
isLooping: action.isLooping,
frameSpeed: action.frameSpeed,
frameWidth: action.frameWidth,
frameHeight: action.frameHeight,
}
}) ?? []
spriteActions:
spriteActions.value?.map((action) => {
return {
action: action.action,
sprites: action.sprites,
origin_x: action.origin_x,
origin_y: action.origin_y,
isAnimated: action.isAnimated,
isLooping: action.isLooping,
frameSpeed: action.frameSpeed,
frameWidth: action.frameWidth,
frameHeight: action.frameHeight
}
}) ?? []
}
gameStore.connection?.emit('gm:sprite:update', updatedSprite, (response: boolean) => {
@ -161,7 +162,7 @@ function addNewImage() {
isLooping: false,
frameSpeed: 0,
frameWidth: 0,
frameHeight: 0,
frameHeight: 0
}
if (!spriteActions.value) {

View File

@ -94,4 +94,4 @@ const drop = (event: DragEvent, dropIndex: number) => {
}
draggedIndex.value = null
}
</script>
</script>