Skip to content

Commit 58dd5b1

Browse files
committed
2 parents d87dfc6 + 8f8e5e9 commit 58dd5b1

6 files changed

Lines changed: 355 additions & 133 deletions

File tree

public/assets/tilemaps/world.json

Lines changed: 219 additions & 93 deletions
Large diffs are not rendered by default.

public/assets/tilemaps/world.tmx

Lines changed: 119 additions & 28 deletions
Large diffs are not rendered by default.

src/game/interactables.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ class Door extends Phaser.GameObjects.Sprite implements Interactable {
127127
this.id = id;
128128
this.position = { x, y };
129129
this.state = open ? 1 : 0;
130+
this.isActive = open;
130131
this.gameScene = scene as Game;
131132
this.doorId = doorId;
132133
scene.add.existing(this);

src/game/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const config: Phaser.Types.Core.GameConfig = {
4444
default: 'arcade',
4545
arcade: {
4646
gravity: {x: 0, y: 0},
47-
debug: true
47+
debug: false
4848
}
4949
}
5050
};

src/game/scenes/Game.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ class Game extends Scene
116116
this.createDecor()
117117

118118
// this.showPopup("Welcome brave adventurer!", 10, 10, 300, 100, 3000, 30, "test name")
119-
this.showPopup("Crackpot alchemy balls",
120-
10, this.camera.height - 210, this.camera.width - 20, 200, 3000, 30, "name2")
119+
//this.showPopup("Crackpot alchemy balls",
120+
// 10, this.camera.height - 210, this.camera.width - 20, 200, 3000, 30, "name2")
121121

122122
this.createMagicBeams()
123123
this.createRestartB();

src/game/scenes/GameImpls/Controllables.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,18 @@ function addControllables(){
214214
trashCanLayer.objects.forEach((obj, idx) => {
215215
const x = (obj.x ?? 0) + 30;
216216
const y = (obj.y ?? 0) + 30 - (obj.height ?? 0);
217-
const trashCan = new TrashCan(this, idx, x, y);
218-
(trashCan.body as Phaser.Physics.Arcade.Body).setSize(trashCan.width/2, 20);
219-
this.trashCans.add(trashCan);
220-
trashCan.setDepth(2);
221-
// console.log(`Created trash can at (${x}, ${y})`);
222-
217+
if(obj.properties && obj.properties[0]) {
218+
const heldItems = obj.properties[0].value.split(",").map((item: string) => item.trim() as itemKeys);
219+
const trashCan = new TrashCan(this, idx, x, y, heldItems);
220+
(trashCan.body as Phaser.Physics.Arcade.Body).setSize(trashCan.width/2, 20);
221+
this.trashCans.add(trashCan);
222+
trashCan.setDepth(2);
223+
} else {
224+
const trashCan = new TrashCan(this, idx, x, y);
225+
(trashCan.body as Phaser.Physics.Arcade.Body).setSize(trashCan.width/2, 20);
226+
this.trashCans.add(trashCan);
227+
trashCan.setDepth(2);
228+
}
223229
});
224230
}
225231
this.physics.add.collider(this.trashCans, this.player);
@@ -231,8 +237,7 @@ function addControllables(){
231237
doorLayer.objects.forEach((obj,idx) => {
232238
const x = (obj.x ?? 0)+(obj.width ?? 0)/2;
233239
const y = (obj.y ?? 0)-(obj.height ?? 0)/2;
234-
const door = new Door(this, idx, x, y, obj.id, obj.name.slice(0,4), obj.properties.open);
235-
// const door = new Door(this, idx, x, y, obj.id, obj.properties.open);
240+
const door = new Door(this, idx, x, y, obj.id, obj.name.slice(0,4), obj.properties[0].value);
236241
this.doors.add(door);
237242
door.setDepth(2);
238243
// console.log(`Created door at (${x}, ${y})`);
@@ -276,7 +281,6 @@ function addControllables(){
276281
decorLayer.objects.forEach((obj) => {
277282
const x = (obj.x ?? 0) + (obj.width ?? 0)/2;
278283
const y = (obj.y ?? 0) - (obj.height ?? 0)/2;
279-
console.log(obj.name);
280284
const decor = this.add.image(x, y, obj.name ?? 'glass_shards');
281285
decor.setDisplaySize((obj.width ?? decor.width), (obj.height ?? decor.height))
282286
decor.setFlipX(obj.flippedHorizontal ?? false);

0 commit comments

Comments
 (0)