From 8df838c405e0110d99a40fb5d7bc28accb662dfe Mon Sep 17 00:00:00 2001 From: SomewhatMay Date: Sat, 2 Nov 2024 20:46:52 -0400 Subject: [PATCH] clouds fixed --- public/assets/interactables.json | 41 +------------------ src/scenes/game/interactables/interactable.ts | 1 + .../interactables/interaction-listener.ts | 1 + .../{cloud-containers => }/cloud-container.ts | 15 +++---- .../cloud-containers/cloud-container1.ts | 11 ----- .../cloud-containers/index.ts | 1 - src/scenes/game/world-decoration/index.ts | 10 ++--- src/scenes/ui/menu.ts | 6 ++- 8 files changed, 18 insertions(+), 68 deletions(-) rename src/scenes/game/world-decoration/{cloud-containers => }/cloud-container.ts (85%) delete mode 100644 src/scenes/game/world-decoration/cloud-containers/cloud-container1.ts delete mode 100644 src/scenes/game/world-decoration/cloud-containers/index.ts diff --git a/public/assets/interactables.json b/public/assets/interactables.json index a65a019..100a4df 100644 --- a/public/assets/interactables.json +++ b/public/assets/interactables.json @@ -12,46 +12,7 @@ "observe": "Long, silky, and elegant strands that are lustrous and green. Gentle, thin, yet resilient, swaying harmoniously with the wind and sparkling against the sunlight. ", "touch": "Every strand feels smooth yet subtly textured. Firm, but gentle―the balance of strength and softness felt as you glide your fingers across the cool surface.", "smell": "A faint gentle sweet aroma, similar to a vanilla smell. A welcoming smell, filling your nose with comfort and sweetness that remains even after you pull away.", - - "discovered": { - "observe": false, - "touch": false, - "smell": false - } - }, - { - "imageKey": "grassblock", - "imageUrl": "assets/grass-block.png", - "scale": 1, - "interactionDistance": 1, - "distanceVariance": [0.3, 0.6], - "itemCountVariance": [2, 4], - - "title": "Grassblock", - "sourceUrl": "https://example.com", - "observe": "Long, silky, and elegant strands that are lustrous and green. Gentle, thin, yet resilient, swaying harmoniously with the wind and sparkling against the sunlight. ", - "touch": "Every strand feels smooth yet subtly textured. Firm, but gentle―the balance of strength and softness felt as you glide your fingers across the cool surface.", - "smell": "A faint gentle sweet aroma, similar to a vanilla smell. A welcoming smell, filling your nose with comfort and sweetness that remains even after you pull away.", - - "discovered": { - "observe": false, - "touch": false, - "smell": false - } - }, - { - "imageKey": "stickman", - "imageUrl": "assets/player-idle.png", - "scale": 1, - "interactionDistance": 500, - "distanceVariance": [0.3, 0.6], - "itemCountVariance": [2, 4], - - "title": "Stickman", - "sourceUrl": "https://example.com", - "observe": "Long, silky, and elegant strands that are lustrous and green. Gentle, thin, yet resilient, swaying harmoniously with the wind and sparkling against the sunlight. ", - "touch": "Every strand feels smooth yet subtly textured. Firm, but gentle―the balance of strength and softness felt as you glide your fingers across the cool surface.", - "smell": "A faint gentle sweet aroma, similar to a vanilla smell. A welcoming smell, filling your nose with comfort and sweetness that remains even after you pull away.", + "research": "Woah, cool!", "discovered": { "observe": false, diff --git a/src/scenes/game/interactables/interactable.ts b/src/scenes/game/interactables/interactable.ts index c7c6716..0ed9816 100644 --- a/src/scenes/game/interactables/interactable.ts +++ b/src/scenes/game/interactables/interactable.ts @@ -17,6 +17,7 @@ export type InteractableInfo = { observe: string; touch: string; smell: string; + research: string; discovered: { observe: boolean; diff --git a/src/scenes/game/interactables/interaction-listener.ts b/src/scenes/game/interactables/interaction-listener.ts index c0f592c..39ea390 100644 --- a/src/scenes/game/interactables/interaction-listener.ts +++ b/src/scenes/game/interactables/interaction-listener.ts @@ -48,6 +48,7 @@ export class InteractionListener { createInteraction("E", "observe"); createInteraction("F", "touch"); createInteraction("Q", "smell"); + createInteraction("R", "research"); scene.input.keyboard?.on("keydown", (event: any) => { if (event.key == "Escape") { diff --git a/src/scenes/game/world-decoration/cloud-containers/cloud-container.ts b/src/scenes/game/world-decoration/cloud-container.ts similarity index 85% rename from src/scenes/game/world-decoration/cloud-containers/cloud-container.ts rename to src/scenes/game/world-decoration/cloud-container.ts index 32b04ea..91c8b79 100644 --- a/src/scenes/game/world-decoration/cloud-containers/cloud-container.ts +++ b/src/scenes/game/world-decoration/cloud-container.ts @@ -1,11 +1,11 @@ import { Physics } from "phaser"; -import { Game as MainGame } from "../../index"; -import { DecorationContainer } from "../decoration-container"; -import { screenSize } from "../../../../constants"; +import { Game as MainGame } from "../index"; +import { DecorationContainer } from "./decoration-container"; +import { screenSize } from "../../../constants"; -export abstract class CloudContainer extends DecorationContainer { - cloudScale = 1; - cloudSpeed = 0.15; +export class CloudContainer extends DecorationContainer { + cloudScale = 8; + cloudSpeed = 0.01; // static scaleVariation = 3; // deviation from treeScale (subtraction or addition) static cloudCount = 6; // number of tree textures labeled as "tree{n}" [0, n) @@ -20,9 +20,6 @@ export abstract class CloudContainer extends DecorationContainer { .get("cloud" + i) .setFilter(Phaser.Textures.FilterMode.NEAREST); } - } - - create() { this.populateClouds(10); } diff --git a/src/scenes/game/world-decoration/cloud-containers/cloud-container1.ts b/src/scenes/game/world-decoration/cloud-containers/cloud-container1.ts deleted file mode 100644 index 0a31327..0000000 --- a/src/scenes/game/world-decoration/cloud-containers/cloud-container1.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Physics } from "phaser"; -import { Game as MainGame } from "../../index"; -import { CloudContainer } from "./cloud-container"; - -export class CloudContainer1 extends CloudContainer { - constructor(scene: MainGame, cloudGroup: Physics.Arcade.StaticGroup) { - super(scene, cloudGroup); - this.cloudScale = 8; - this.create(); - } -} diff --git a/src/scenes/game/world-decoration/cloud-containers/index.ts b/src/scenes/game/world-decoration/cloud-containers/index.ts deleted file mode 100644 index 8b017a2..0000000 --- a/src/scenes/game/world-decoration/cloud-containers/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./cloud-container1"; diff --git a/src/scenes/game/world-decoration/index.ts b/src/scenes/game/world-decoration/index.ts index 00fd4ea..5fa6fe3 100644 --- a/src/scenes/game/world-decoration/index.ts +++ b/src/scenes/game/world-decoration/index.ts @@ -8,7 +8,7 @@ import { TreeContainer2, TreeContainer3, } from "./tree-containers"; -import { CloudContainer1 } from "./cloud-containers"; +import { CloudContainer } from "./cloud-container"; import { screenSize } from "../../../constants"; type ContainerInfo = { @@ -30,11 +30,11 @@ export class WorldDecoration { FOREGROUND_CLASS = GrassContainer; foregroundGroup: Physics.Arcade.StaticGroup; - CLOUD_CLASS = CloudContainer1; - cloudContainer: CloudContainer1; + CLOUD_CLASS = CloudContainer; + cloudContainer: CloudContainer; decorationContainers: ContainerInfo[] = [ - { speedMultiplier: 0.025, class: CloudContainer1 }, + { speedMultiplier: 0.025, class: CloudContainer }, { speedMultiplier: 1, class: GrassContainer }, { speedMultiplier: 0.075, class: MountainContainer }, { speedMultiplier: 0.15, class: TreeContainer3 }, // farther ones should be drawn first @@ -59,7 +59,7 @@ export class WorldDecoration { if (containerInfo.class == this.FOREGROUND_CLASS) { this.foregroundGroup = staticGroup; } else if (containerInfo.class == this.CLOUD_CLASS) { - this.cloudContainer = instance as CloudContainer1; + this.cloudContainer = instance as CloudContainer; } }); } diff --git a/src/scenes/ui/menu.ts b/src/scenes/ui/menu.ts index fa611d5..bb80e74 100644 --- a/src/scenes/ui/menu.ts +++ b/src/scenes/ui/menu.ts @@ -22,15 +22,16 @@ export class Menu extends UIContainer { draw() { this.clear(); - this.drawRoundRect(0, 0, Menu.WIDTH, 200); + this.drawRoundRect(0, 0, Menu.WIDTH, 230); this.drawText(Menu.WIDTH / 2, 10, "Item:", 19).setOrigin(0.5, 0); + let discovered = 0; const target = this.store.get("target"); if (target !== "") { const info = this.store.getInfo( target as string ) as unknown as InteractableInfo; - const discovered = this.store.getDiscovered(target); + discovered = this.store.getDiscovered(target); this.drawText( Menu.WIDTH / 2, 32, @@ -51,6 +52,7 @@ export class Menu extends UIContainer { this.drawAction("[E] Observe", 0); this.drawAction("[F] Touch", 1); this.drawAction("[Q] Smell", 2); + this.drawAction("[R] Research " + (discovered === 100 ? "🔓" : "🔒"), 3); } subscribeToEvents() {