Skip to content

Commit

Permalink
sweetgrass added
Browse files Browse the repository at this point in the history
  • Loading branch information
SomewhatMay committed Nov 2, 2024
1 parent 49cd7cd commit 811223b
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 32 deletions.
1 change: 1 addition & 0 deletions CITATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ stickman figures - https://www.deviantart.com/turboignited/art/Stickman-Spritesh
mountain sprite - https://www.deviantart.com/jonata-d/art/Mountain-Sprite-001-706211298
grass tile set - https://xeleph.itch.io/side-view-grass-tileset
tree textures - https://graphscriptdev.itch.io/plant-trees?download
plant textures - https://www.shutterstock.com/image-vector/trees-bushes-grass-style-pixel-art-2255025673
12 changes: 6 additions & 6 deletions public/assets/interactables.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[
{
"imageKey": "player-idle",
"imageUrl": "assets/player-idle.png",
"imageKey": "sweetgrass",
"imageUrl": "assets/sweetgrass.png",
"scale": 1,
"xCoordinate": 150,

"title": "Title",
"title": "Sweetgrass",
"sourceUrl": "https://example.com",
"observe": "This is a cool thing",
"touch": "This is what it feels like",
"smell": "I smell something",
"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,
Expand Down
Binary file added public/assets/sage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/sweetgrass.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/tobacco.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 15 additions & 9 deletions src/scenes/game/interactables/interactable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,21 @@ export class Interactable {
private worldDecoration: WorldDecoration,
public info: InteractableInfo
) {
this.object = this.scene.add
.image(
this.info.xCoordinate,
screenSize.y - GrassContainer.grassSize.y,
this.info.imageKey
)
.setOrigin(0, 1)
.setScale(this.info.scale);
this.worldDecoration.addToForegroundGroup(this.object);
for (let i = -1; i < 2; i++) {
const newImage = this.scene.add
.image(0, 0, this.info.imageKey)
.setOrigin(0, 1)
.setScale(this.info.scale);
newImage.setPosition(
this.info.xCoordinate + i * newImage.width * this.info.scale,
screenSize.y - GrassContainer.grassSize.y
);
this.worldDecoration.addToForegroundGroup(newImage);

if (i == 0) {
this.object = newImage;
}
}
}

getX() {
Expand Down
2 changes: 1 addition & 1 deletion src/scenes/game/mover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class Mover {

worldPos = 0; // player oriented
lowerWorldBound = -1e3; // px, exclusive
upperWorldBound = 1e5; // px, exclusive
upperWorldBound = 4e4; // px, exclusive

constructor(
private inputHandler: InputHandler,
Expand Down
2 changes: 1 addition & 1 deletion src/scenes/game/world-decoration/grass-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class GrassContainer extends DecorationContainer {

constructor(scene: MainGame, worldGroup: Physics.Arcade.StaticGroup) {
super(scene, worldGroup);
this.populateGrass(800);
this.populateGrass(500);
this.scene.textures
.get("grass")
.setFilter(Phaser.Textures.FilterMode.NEAREST);
Expand Down
6 changes: 3 additions & 3 deletions src/scenes/game/world-decoration/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export class WorldDecoration {
decorationContainers: ContainerInfo[] = [
{ speedMultiplier: 1, class: GrassContainer },
{ speedMultiplier: 0.075, class: MountainContainer },
{ speedMultiplier: 0.1, class: TreeContainer3 }, // farther ones should be drawn first
{ speedMultiplier: 0.11, class: TreeContainer2 },
{ speedMultiplier: 0.125, class: TreeContainer1 },
{ speedMultiplier: 0.15, class: TreeContainer3 }, // farther ones should be drawn first
{ speedMultiplier: 0.2, class: TreeContainer2 },
{ speedMultiplier: 0.25, class: TreeContainer1 },
];

decorationInfos: DecorationInfo[] = [];
Expand Down
7 changes: 2 additions & 5 deletions src/scenes/game/world-decoration/mountain-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@ import { DecorationContainer } from "./decoration-container";
export class MountainContainer extends DecorationContainer {
static mountainScale = 3.5;

constructor(
scene: MainGame,
mountainGroup: Physics.Arcade.StaticGroup
) {
constructor(scene: MainGame, mountainGroup: Physics.Arcade.StaticGroup) {
super(scene, mountainGroup);
this.scene.textures
.get("mountain")
.setFilter(Phaser.Textures.FilterMode.NEAREST);

this.populateMountains(10);
this.populateMountains(4);
}

createMountain(x: number) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export abstract class TreeContainer extends DecorationContainer {
}

create() {
this.populateTrees(100);
this.populateTrees(15);
}

createTree(x: number) {
Expand All @@ -39,7 +39,7 @@ export abstract class TreeContainer extends DecorationContainer {
}

populateTrees(width: number) {
for (let i = -1; i < width - 1; i += 0.5 + Math.random() * 1.5) {
for (let i = -1; i < width - 1; i += 2 + Math.random()) {
this.createTree(i);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { TreeContainer } from "./tree-container";
export class TreeContainer1 extends TreeContainer {
constructor(scene: MainGame, treeGroup: Physics.Arcade.StaticGroup) {
super(scene, treeGroup);
this.treeScale = 8;
this.treeScale = 9;
this.create();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { TreeContainer } from "./tree-container";
export class TreeContainer2 extends TreeContainer {
constructor(scene: MainGame, treeGroup: Physics.Arcade.StaticGroup) {
super(scene, treeGroup);
this.treeScale = 7;
this.treeScale = 7.5;
this.create();
}
}
7 changes: 5 additions & 2 deletions src/scenes/ui/info-display.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class InfoDisplay extends UIContainer {
draw() {
this.clear();
this.drawRoundRect(0, 0, InfoDisplay.WIDTH, 195);
this.drawText(InfoDisplay.WIDTH / 2, 10, "Observing").setOrigin(0.5, 0);
this.drawText(InfoDisplay.WIDTH / 2, 10, "Examining...").setOrigin(0.5, 0);
this.drawText(InfoDisplay.WIDTH / 2, 30, "[ESC] Go Back", 12).setOrigin(
0.5,
0
Expand All @@ -37,7 +37,10 @@ export class InfoDisplay extends UIContainer {
this.drawText(
InfoDisplay.WIDTH / 2,
lineY + 4,
(this.store.getInfo(target) as never)[action as never]
(this.store.getInfo(target) as never)[action as never],
undefined,
undefined,
InfoDisplay.WIDTH - 32
).setOrigin(0.5, 0);
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/scenes/ui/ui-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ export abstract class UIContainer {
y: number,
text: string,
fontSize: number = 16,
color: string = "black"
color: string = "black",
wordWrap: number = Number.MAX_SAFE_INTEGER
) {
const textObj = this.scene.add.text(
x + this.offsetX,
Expand All @@ -77,6 +78,7 @@ export abstract class UIContainer {
{
fontFamily: 'Georgia, "Goudy Bookletter 1911", Times, serif',
fontSize: fontSize + "px",
wordWrap: { width: wordWrap },
}
);
textObj.setColor(color);
Expand Down

0 comments on commit 811223b

Please sign in to comment.