Tile-triggered text bubbles
authorRuben Rodriguez <ruben@gnu.org>
Wed, 10 Mar 2021 21:38:43 +0000 (16:38 -0500)
committerRuben Rodriguez <ruben@gnu.org>
Wed, 10 Mar 2021 21:38:43 +0000 (16:38 -0500)
front/src/Phaser/Game/GameScene.ts

index 2b553a4d263447a54df0fcb06db1b0605f5a72d6..ea8edd5bd127608bf777a9981eb8d7a678a1cd63 100644 (file)
@@ -435,9 +435,11 @@ export class GameScene extends Phaser.Scene {
         // debug code to get a tile properties by clicking on it
         this.input.on("pointerdown", (pointer: Phaser.Input.Pointer)=>{
             //pixel position toz tile position
-            let tile = this.Map.getTileAt(this.Map.worldToTileX(pointer.worldX), this.Map.worldToTileY(pointer.worldY));
+            let tile = this.Map.getTileAt(this.Map.worldToTileX(pointer.worldX), this.Map.worldToTileY(pointer.worldY), false, "override");
             if(tile){
-                this.CurrentPlayer.say("Your touch " + tile.layer.name);
+                if (tile.properties["say"] !== undefined){
+                  this.CurrentPlayer.say(tile.properties["say"]);
+                }
             }
         });
     }