@@ -5,9 +5,6 @@ class ElevatorManager {
55 this . player = player ;
66 this . isLocked = false ;
77
8- this . elevatorZones = [ ] ;
9- this . zoneGraphics = [ ] ;
10-
118 this . currentDoorState = Array ( this . scene . buildingManager . floors . length ) . fill ( 'closed' ) ;
129 this . elevatorCurrentFloor = scene . currentFloor ;
1310
@@ -19,28 +16,29 @@ class ElevatorManager {
1916 for ( let i = 0 ; i < scene . buildingManager . floors . length ; i ++ ) {
2017 const y = scene . getFloorY ( i ) - GameConfig . GROUND_HEIGHT - GameConfig . SPRITE_HEIGHT + 3 ;
2118
22- const zone = scene . add . zone ( elevatorX , y , 50 , 50 ) ;
23- zone . setInteractive ( ) ;
24- zone . floorIndex = i ;
25-
26- /*
27- const g = this.scene.add.graphics();
28- g.lineStyle(2, 0xFFFF00);
29- if (i === this.elevatorCurrentFloor) {
30- g.fillStyle(0xFFFF00, 0.3);
31- g.fillRect(elevatorX - 25, y - 25, 50, 50);
32- }
33- g.strokeRect(elevatorX - 25, y - 25, 50, 50);
34- this.zoneGraphics.push(g);
35- g.setAlpha(i === this.elevatorCurrentFloor ? 0.3 : 0); // only keep yellow tint
36- */
3719
38- this . elevatorZones . push ( zone ) ;
3920 const elevatorSprite = this . scene . add . image ( elevatorX , y + 25 , 'Elevator_closed' ) ;
4021 elevatorSprite . setDepth ( 1 ) ;
41- elevatorSprite . setScale ( 2 ) ; // or maybe 1.15 for better fit
42-
43- elevatorSprite . setOrigin ( 0.5 , 1 ) ; // bottom aligned
22+ elevatorSprite . setScale ( 2 ) ;
23+ elevatorSprite . setOrigin ( 0.5 , 1 ) ;
24+
25+ //elevator backdrop
26+ const tileSize = 16 ;
27+ const backdropRT = this . scene . add . renderTexture ( elevatorX , y + 25 + 5 , 32 , 32 ) ;
28+ backdropRT . setOrigin ( 0.5 , 1 ) ;
29+ backdropRT . setDepth ( 0 ) ;
30+ backdropRT . setScale ( 2 ) ;
31+
32+ // Top-left of red background is tile index 512
33+ const indices = [ 1225 , 1226 , 1260 , 1261 ] ;
34+
35+ let bdrop = 0 ;
36+ for ( let row = 0 ; row < 2 ; row ++ ) {
37+ for ( let col = 0 ; col < 2 ; col ++ ) {
38+ backdropRT . drawFrame ( 'wallpaper_tiles' , indices [ bdrop ] , col * tileSize , row * tileSize ) ;
39+ bdrop ++ ;
40+ }
41+ }
4442
4543 this . elevatorSprites . push ( elevatorSprite ) ;
4644 }
@@ -323,24 +321,6 @@ continueElevatorTravel(originalTarget, direction) {
323321}
324322
325323
326- updateZoneGraphics ( currentFloor ) {
327- this . zoneGraphics . forEach ( ( g , i ) => {
328- g . clear ( ) ;
329-
330- const zone = this . elevatorZones [ i ] ;
331- const x = zone . x ;
332- const y = zone . y ;
333-
334- if ( i === currentFloor ) {
335- g . fillStyle ( 0xFFFF00 , 0.3 ) ;
336- g . fillRect ( x - 25 , y - 25 , 50 , 50 ) ;
337- }
338-
339- g . strokeRect ( x - 25 , y - 25 , 50 , 50 ) ;
340- g . setAlpha ( i === currentFloor ? 0.3 : 0 ) ; // <-- important
341- } ) ;
342- }
343-
344324updateElevatorSprite ( floorIndex , isOpen ) {
345325 const sprite = this . elevatorSprites [ floorIndex ] ;
346326 if ( ! sprite ) return ;
0 commit comments