diff --git a/src/components/GuessingGame.vue b/src/components/GuessingGame.vue new file mode 100644 index 0000000..2a611ea --- /dev/null +++ b/src/components/GuessingGame.vue @@ -0,0 +1,617 @@ + + + + + diff --git a/src/components/PetGame.vue b/src/components/PetGame.vue index 9a394b8..fb73d2d 100644 --- a/src/components/PetGame.vue +++ b/src/components/PetGame.vue @@ -5,7 +5,7 @@ :disabled="stage === 'egg'" @info="showPetInfo = !showPetInfo" @feed="$emit('action', 'feed')" - @play="$emit('action', 'play')" + @playMenu="showPlayMenu = true" @sleep="$emit('action', 'sleep')" /> @@ -199,6 +199,20 @@ @close="showPetInfo = false" /> + + + + + + 0) { - const maxPoopRight = Math.max(...areas.map(a => a.right)); - if (targetFoodX < maxPoopRight + 10) { - // Move food to the right of poop areas - targetFoodX = maxPoopRight + 15; - } - } - - // Ensure food stays within bounds - const cw = containerRef.value?.clientWidth || 300; - targetFoodX = Math.max(10, Math.min(cw - 40, targetFoodX)); - - foodX.value = targetFoodX; - foodX.value = targetFoodX; + // Food drops right in front of pet's mouth (don't move the pet) + // Position food based on which way pet is facing + const mouthOffsetX = isFacingRight.value ? -foodSize - 2 : width + 2; + foodX.value = petX.value + mouthOffsetX; foodY.value = 0; // Start from top of screen // Calculate target Y (at mouth level) const targetY = petY.value + (mouthY * pixelSize) - (foodSize / 2); - // Only avoid poop areas vertically if there's actual poop - let safeTargetY = targetY; - if (areas.length > 0) { - const maxPoopBottom = Math.max(...areas.map(a => a.bottom)); - safeTargetY = Math.min(targetY, maxPoopBottom - foodSize - 5); - } + console.log('Food dropping to:', foodX.value, targetY, 'Pet at:', petX.value, petY.value); - // Move pet to food - const targetPetX = isFacingRight.value ? targetFoodX - width - 5 : targetFoodX + (10 * pixelSize) + 5; - - // Force pet to be at the correct position to eat - // This ensures that even if the food was moved due to bounds/poop, the pet is there - petX.value = targetPetX; - - // Simple animation sequence - // 1. Drop food - // 2. Pet moves to food - // 3. Pet eats (mouth open/close) - - // ... (Existing feeding logic would go here, but we rely on state='eating' triggers from parent) - - // Animate falling to front of pet + // Animate falling to pet's mouth const duration = 800; const startTime = performance.now(); @@ -975,7 +976,7 @@ async function startFeeding(type) { const progress = Math.min(elapsed / duration, 1); // Ease out for smoother landing const eased = 1 - Math.pow(1 - progress, 3); - foodY.value = eased * safeTargetY; + foodY.value = eased * targetY; if (progress < 1) { requestAnimationFrame(animateFall); diff --git a/src/components/PlayMenu.vue b/src/components/PlayMenu.vue new file mode 100644 index 0000000..11e3d5c --- /dev/null +++ b/src/components/PlayMenu.vue @@ -0,0 +1,212 @@ + + + + + diff --git a/src/components/TopMenu.vue b/src/components/TopMenu.vue index 3d58338..e308bd8 100644 --- a/src/components/TopMenu.vue +++ b/src/components/TopMenu.vue @@ -2,7 +2,7 @@
- +
@@ -15,7 +15,7 @@ const props = defineProps({ } }); -defineEmits(['info', 'feed', 'play', 'sleep']); +defineEmits(['info', 'feed', 'playMenu', 'sleep']);