forked from andriikushch/game-off-2018
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlayer_init.js
27 lines (26 loc) · 1.37 KB
/
layer_init.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function solidLayerInit() {
// When loading from an array, make sure to specify the tileWidth and tileHeight
const solidMap = this.make.tilemap({data: solidLevel, tileWidth: 16, tileHeight: 16});
const solidTiles = solidMap.addTilesetImage("mario-tiles");
solidLayer = solidMap.createStaticLayer(0, solidTiles, 0, 600 - cellSize * solidLevel.length);
solidLayer.scaleX = 2;
solidLayer.scaleY = 2;
solidLayer.setCollisionByProperty({collides: true});
// const debugGraphics = this.add.graphics().setAlpha(0.75);
// solidLayer.renderDebug(debugGraphics, {
// tileColor: null, // Color of non-colliding tiles
// collidingTileColor: new Phaser.Display.Color(243, 134, 48, 255), // Color of colliding tiles
// faceColor: new Phaser.Display.Color(40, 39, 37, 255) // Color of colliding face edges
// });
solidLayer.setCollision(3);
//
// ///////////////////
// // When loading from an array, make sure to specify the tileWidth and tileHeight
// const weakMap = this.make.tilemap({data: weakLevel, tileWidth: 16, tileHeight: 16});
// const weakTiles = weakMap.addTilesetImage("mario-tiles");
// weakLayer = weakMap.createStaticLayer(0, weakTiles, 0, 600 - cellSize * weakLevel.length);
// weakLayer.scaleX = 2;
// weakLayer.scaleY = 2;
//
// weakWalls = weakMap.createFromTiles(4, 2, 'weakWalls');
}