johnny961 commited on
Commit
943dbfa
·
1 Parent(s): f28e771

latest game version

Browse files
static/game/apt.json CHANGED
@@ -3243,7 +3243,7 @@
3243
  ],
3244
  "rooms": [
3245
  [
3246
- "Kichen",
3247
  [
3248
  {
3249
  "x": 28,
@@ -3362,8 +3362,8 @@
3362
  ]
3363
  ],
3364
  "characterPos": {
3365
- "x": 28,
3366
- "y": 15
3367
  },
3368
  "gridCols": 32,
3369
  "gridRows": 20
 
3243
  ],
3244
  "rooms": [
3245
  [
3246
+ "Kitchen",
3247
  [
3248
  {
3249
  "x": 28,
 
3362
  ]
3363
  ],
3364
  "characterPos": {
3365
+ "x": 4,
3366
+ "y": 16
3367
  },
3368
  "gridCols": 32,
3369
  "gridRows": 20
static/game/gameState.js CHANGED
@@ -4,9 +4,9 @@
4
  constructor() {
5
  // Initialize with rooms from apt.json
6
  this.rooms = [
 
7
  "Kichen",
8
  "Storage",
9
- "My Bedroom",
10
  "Bathroom",
11
  "Main Hallway",
12
  "Living Room",
@@ -17,7 +17,9 @@
17
  ];
18
 
19
  this.hideTargets = ["bed", "coat closet", "table", "shower"];
 
20
  this.searchTargets = ["dresser", "stove", "desk", "cabinet", "fridge", "bookcase"];
 
21
  this.items = ["lock pick", "flashlight", "knife", "remote"];
22
  this.useTargets = ["bedroom door", "main door", "TV"];
23
 
@@ -26,7 +28,10 @@
26
  this.inventory = [];
27
  this.isHiding = false;
28
  }
29
-
 
 
 
30
  handleAction(action, target) {
31
  switch (action) {
32
  case 'go':
 
4
  constructor() {
5
  // Initialize with rooms from apt.json
6
  this.rooms = [
7
+ "My Bedroom",
8
  "Kichen",
9
  "Storage",
 
10
  "Bathroom",
11
  "Main Hallway",
12
  "Living Room",
 
17
  ];
18
 
19
  this.hideTargets = ["bed", "coat closet", "table", "shower"];
20
+
21
  this.searchTargets = ["dresser", "stove", "desk", "cabinet", "fridge", "bookcase"];
22
+
23
  this.items = ["lock pick", "flashlight", "knife", "remote"];
24
  this.useTargets = ["bedroom door", "main door", "TV"];
25
 
 
28
  this.inventory = [];
29
  this.isHiding = false;
30
  }
31
+ setCurrentRoom(room) {
32
+ this.currentRoom = room;
33
+ }
34
+
35
  handleAction(action, target) {
36
  switch (action) {
37
  case 'go':
static/game/index.html CHANGED
@@ -413,6 +413,14 @@
413
  if (path.length === 0) {
414
  isMoving = false;
415
  clearInterval(moveInterval);
 
 
 
 
 
 
 
 
416
  return;
417
  }
418
  const nextPos = path.shift();
 
413
  if (path.length === 0) {
414
  isMoving = false;
415
  clearInterval(moveInterval);
416
+ // Update game state with new room when movement is complete
417
+ const currentRoomEntry = Array.from(rooms.entries())
418
+ .find(([_, cells]) => cells.some(cell =>
419
+ cell.x === characterPos.x && cell.y === characterPos.y
420
+ ));
421
+ if (currentRoomEntry) {
422
+ gameState.setCurrentRoom(currentRoomEntry[0]);
423
+ }
424
  return;
425
  }
426
  const nextPos = path.shift();
static/index.html CHANGED
@@ -25,7 +25,6 @@
25
  <nav class="menu">
26
  <a href="game/" class="menu-item new-game">NEW GAME</a>
27
  <a href="how-to-play.html" class="menu-item how-to-play">HOW TO PLAY</a>
28
- <a href="maker/" class="menu-item level-maker">LEVEL MAKER</a>
29
  </nav>
30
  <div class="character">
31
  <img src="assets/img/perso.png" alt="Character" />
 
25
  <nav class="menu">
26
  <a href="game/" class="menu-item new-game">NEW GAME</a>
27
  <a href="how-to-play.html" class="menu-item how-to-play">HOW TO PLAY</a>
 
28
  </nav>
29
  <div class="character">
30
  <img src="assets/img/perso.png" alt="Character" />