Initial commit
This commit is contained in:
commit
26b8412f3c
13 changed files with 4146 additions and 0 deletions
35
front/src/GameScene.ts
Normal file
35
front/src/GameScene.ts
Normal file
|
@ -0,0 +1,35 @@
|
|||
|
||||
export class GameScene extends Phaser.Scene {
|
||||
|
||||
constructor() {
|
||||
super({
|
||||
key: "GameScene"
|
||||
});
|
||||
}
|
||||
|
||||
preload(): void {
|
||||
this.load.image('tiles', 'maps/tiles.png');
|
||||
this.load.tilemapTiledJSON('map', 'maps/map2.json');
|
||||
}
|
||||
|
||||
init(): void {
|
||||
}
|
||||
|
||||
create(): void {
|
||||
let mappy = this.add.tilemap("map");
|
||||
let terrain = mappy.addTilesetImage("tiles", "tiles");
|
||||
|
||||
let bottomLayer = mappy.createStaticLayer("Calque 1", [terrain], 0, 0);
|
||||
let topLayer = mappy.createStaticLayer("Calque 2", [terrain], 0, 0);
|
||||
|
||||
}
|
||||
|
||||
private angle: number = 0;
|
||||
|
||||
update(dt: number): void {
|
||||
this.cameras.main.scrollX = Math.floor(300 + 300 * Math.cos(this.angle));
|
||||
this.cameras.main.scrollY = Math.floor(300 + 300 * Math.sin(this.angle));
|
||||
|
||||
this.angle = dt * 0.0001;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue