added a rock
This commit is contained in:
parent
793e5318f7
commit
241cbd720a
6 changed files with 53 additions and 2 deletions
|
@ -1,6 +1,10 @@
|
|||
import {MapManagerInterface, MapManager} from "./MapManager";
|
||||
import {GameManagerInterface} from "./GameManager";
|
||||
|
||||
export enum Textures {
|
||||
Rock = 'rock',
|
||||
}
|
||||
|
||||
export interface GameSceneInterface extends Phaser.Scene {
|
||||
RoomId : string;
|
||||
sharedUserPosition(data : []): void;
|
||||
|
@ -18,6 +22,7 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface{
|
|||
|
||||
//hook preload scene
|
||||
preload(): void {
|
||||
this.load.image(Textures.Rock, 'resources/objects/rockSprite.png');
|
||||
this.load.image('tiles', 'maps/tiles.png');
|
||||
this.load.tilemapTiledJSON('map', 'maps/map2.json');
|
||||
this.load.spritesheet('player',
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import {CameraManager, CameraManagerInterface} from "./CameraManager";
|
||||
import {RESOLUTION} from "../../Enum/EnvironmentVariable";
|
||||
import {Player} from "../Player/Player";
|
||||
import {GameScene, GameSceneInterface} from "./GameScene";
|
||||
import {UserInputManager} from "../UserInput/UserInputManager";
|
||||
import {Rock} from "../Rock/Rock";
|
||||
import {GameSceneInterface} from "./GameScene";
|
||||
import {UserInputEvent, UserInputManager} from "../UserInput/UserInputManager";
|
||||
|
||||
export interface MapManagerInterface {
|
||||
Map: Phaser.Tilemaps.Tilemap;
|
||||
|
@ -21,6 +22,7 @@ export class MapManager implements MapManagerInterface{
|
|||
startX = (window.innerWidth / 2) / RESOLUTION;
|
||||
startY = (window.innerHeight / 2) / RESOLUTION;
|
||||
userInputManager: UserInputManager;
|
||||
private rock: Rock;
|
||||
|
||||
constructor(scene: GameSceneInterface){
|
||||
this.Scene = scene;
|
||||
|
@ -44,11 +46,21 @@ export class MapManager implements MapManagerInterface{
|
|||
this
|
||||
);
|
||||
this.CurrentPlayer.initAnimation();
|
||||
this.rock = new Rock(
|
||||
this.Scene,
|
||||
100,
|
||||
300,
|
||||
);
|
||||
//this.rock.set()
|
||||
}
|
||||
|
||||
update() : void {
|
||||
let activeEvents = this.userInputManager.getEventListForGameTick();
|
||||
|
||||
this.CurrentPlayer.move(activeEvents);
|
||||
|
||||
/*if (activeEvents.get(UserInputEvent.Interact)) {
|
||||
|
||||
}*/
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue