create an env variable for debug mode
This commit is contained in:
parent
751a9f40e5
commit
33c58874e0
1
.env.template
Normal file
1
.env.template
Normal file
@ -0,0 +1 @@
|
|||||||
|
DEBUG_MODE=false
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
|
.env
|
||||||
.idea
|
.idea
|
||||||
.vagrant
|
.vagrant
|
||||||
Vagrantfile
|
Vagrantfile
|
@ -13,6 +13,7 @@ services:
|
|||||||
front:
|
front:
|
||||||
image: thecodingmachine/nodejs:12
|
image: thecodingmachine/nodejs:12
|
||||||
environment:
|
environment:
|
||||||
|
DEBUG_MODE: "$DEBUG_MODE"
|
||||||
HOST: "0.0.0.0"
|
HOST: "0.0.0.0"
|
||||||
NODE_ENV: development
|
NODE_ENV: development
|
||||||
API_URL: http://api.workadventure.localhost
|
API_URL: http://api.workadventure.localhost
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
|
const DEBUG_MODE: boolean = !!process.env.DEBUG_MODE || false;
|
||||||
const API_URL = process.env.API_URL || "http://api.workadventure.localhost";
|
const API_URL = process.env.API_URL || "http://api.workadventure.localhost";
|
||||||
const ROOM = [process.env.ROOM || "THECODINGMACHINE"];
|
const ROOM = [process.env.ROOM || "THECODINGMACHINE"];
|
||||||
const RESOLUTION = 2;
|
const RESOLUTION = 2;
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
DEBUG_MODE,
|
||||||
API_URL,
|
API_URL,
|
||||||
RESOLUTION,
|
RESOLUTION,
|
||||||
ROOM
|
ROOM
|
||||||
|
@ -2,7 +2,7 @@ import {GameManagerInterface, StatusGameManagerEnum} from "./GameManager";
|
|||||||
import {MessageUserPositionInterface} from "../../Connexion";
|
import {MessageUserPositionInterface} from "../../Connexion";
|
||||||
import {CameraManager, CameraManagerInterface} from "./CameraManager";
|
import {CameraManager, CameraManagerInterface} from "./CameraManager";
|
||||||
import {CurrentGamerInterface, GamerInterface, Player} from "../Player/Player";
|
import {CurrentGamerInterface, GamerInterface, Player} from "../Player/Player";
|
||||||
import {RESOLUTION} from "../../Enum/EnvironmentVariable";
|
import {DEBUG_MODE, RESOLUTION} from "../../Enum/EnvironmentVariable";
|
||||||
import Tile = Phaser.Tilemaps.Tile;
|
import Tile = Phaser.Tilemaps.Tile;
|
||||||
|
|
||||||
export enum Textures {
|
export enum Textures {
|
||||||
@ -97,13 +97,14 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface{
|
|||||||
//this.CurrentPlayer.say("Collision with layer : "+ (object2 as Tile).layer.name)
|
//this.CurrentPlayer.say("Collision with layer : "+ (object2 as Tile).layer.name)
|
||||||
});
|
});
|
||||||
Layer.setCollisionByProperty({collides: true});
|
Layer.setCollisionByProperty({collides: true});
|
||||||
//debug code
|
if (DEBUG_MODE) {
|
||||||
//debug code to see the collision hitbox of the object in the top layer
|
//debug code to see the collision hitbox of the object in the top layer
|
||||||
/*Layer.renderDebug(this.add.graphics(), {
|
Layer.renderDebug(this.add.graphics(), {
|
||||||
tileColor: null, //non-colliding tiles
|
tileColor: null, //non-colliding tiles
|
||||||
collidingTileColor: new Phaser.Display.Color(243, 134, 48, 200), // Colliding tiles,
|
collidingTileColor: new Phaser.Display.Color(243, 134, 48, 200), // Colliding tiles,
|
||||||
faceColor: new Phaser.Display.Color(40, 39, 37, 255) // Colliding face edges
|
faceColor: new Phaser.Display.Color(40, 39, 37, 255) // Colliding face edges
|
||||||
});*/
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,6 +143,7 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface{
|
|||||||
//pixel position toz tile position
|
//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));
|
||||||
if(tile){
|
if(tile){
|
||||||
|
console.log(tile)
|
||||||
this.CurrentPlayer.say("Your touch " + tile.layer.name);
|
this.CurrentPlayer.say("Your touch " + tile.layer.name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'phaser';
|
import 'phaser';
|
||||||
import GameConfig = Phaser.Types.Core.GameConfig;
|
import GameConfig = Phaser.Types.Core.GameConfig;
|
||||||
import {GameManager} from "./Phaser/Game/GameManager";
|
import {GameManager} from "./Phaser/Game/GameManager";
|
||||||
import {RESOLUTION} from "./Enum/EnvironmentVariable";
|
import {DEBUG_MODE, RESOLUTION} from "./Enum/EnvironmentVariable";
|
||||||
|
|
||||||
let gameManager = new GameManager();
|
let gameManager = new GameManager();
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ const config: GameConfig = {
|
|||||||
physics: {
|
physics: {
|
||||||
default: "arcade",
|
default: "arcade",
|
||||||
arcade: {
|
arcade: {
|
||||||
debug: true
|
debug: DEBUG_MODE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -29,6 +29,6 @@ module.exports = {
|
|||||||
new webpack.ProvidePlugin({
|
new webpack.ProvidePlugin({
|
||||||
Phaser: 'phaser'
|
Phaser: 'phaser'
|
||||||
}),
|
}),
|
||||||
new webpack.EnvironmentPlugin(['API_URL'])
|
new webpack.EnvironmentPlugin(['API_URL', 'DEBUG_MODE'])
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user