Skip to content

Commit

Permalink
clouds fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
SomewhatMay committed Nov 3, 2024
1 parent a383996 commit 8df838c
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 68 deletions.
41 changes: 1 addition & 40 deletions public/assets/interactables.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/scenes/game/interactables/interactable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export type InteractableInfo = {
observe: string;
touch: string;
smell: string;
research: string;

discovered: {
observe: boolean;
Expand Down
1 change: 1 addition & 0 deletions src/scenes/game/interactables/interaction-listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -20,9 +20,6 @@ export abstract class CloudContainer extends DecorationContainer {
.get("cloud" + i)
.setFilter(Phaser.Textures.FilterMode.NEAREST);
}
}

create() {
this.populateClouds(10);
}

Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion src/scenes/game/world-decoration/cloud-containers/index.ts

This file was deleted.

10 changes: 5 additions & 5 deletions src/scenes/game/world-decoration/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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
Expand All @@ -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;
}
});
}
Expand Down
6 changes: 4 additions & 2 deletions src/scenes/ui/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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() {
Expand Down

0 comments on commit 8df838c

Please sign in to comment.