Merge remote-tracking branch 'github.com/master' into webrtc
# Conflicts: # back/src/Model/Group.ts # back/src/Model/World.ts
This commit is contained in:
commit
aff77fe074
9 changed files with 258 additions and 95 deletions
|
@ -1,4 +1,4 @@
|
|||
const DEBUG_MODE: boolean = !!process.env.DEBUG_MODE || false;
|
||||
const DEBUG_MODE: boolean = process.env.DEBUG_MODE as any === true;
|
||||
const API_URL = process.env.API_URL || "http://api.workadventure.localhost";
|
||||
const ROOM = [process.env.ROOM || "THECODINGMACHINE"];
|
||||
const RESOLUTION = 4;
|
||||
|
|
|
@ -22,18 +22,15 @@ export class PlayableCaracter extends Phaser.Physics.Arcade.Sprite {
|
|||
|
||||
this.setVelocity(x, y);
|
||||
|
||||
//todo improve animations to better account for diagonal movement
|
||||
if (this.body.velocity.x > 0) { //moving right
|
||||
this.play(PlayerAnimationNames.WalkRight, true);
|
||||
}
|
||||
if (this.body.velocity.x < 0) { //moving left
|
||||
this.anims.playReverse(PlayerAnimationNames.WalkLeft, true);
|
||||
}
|
||||
//up or down animationss are prioritized over left and right
|
||||
if (this.body.velocity.y < 0) { //moving up
|
||||
this.play(PlayerAnimationNames.WalkUp, true);
|
||||
}
|
||||
if (this.body.velocity.y > 0) { //moving down
|
||||
} else if (this.body.velocity.y > 0) { //moving down
|
||||
this.play(PlayerAnimationNames.WalkDown, true);
|
||||
} else if (this.body.velocity.x > 0) { //moving right
|
||||
this.play(PlayerAnimationNames.WalkRight, true);
|
||||
} else if (this.body.velocity.x < 0) { //moving left
|
||||
this.anims.playReverse(PlayerAnimationNames.WalkLeft, true);
|
||||
}
|
||||
|
||||
if(this.bubble) {
|
||||
|
|
|
@ -6,8 +6,8 @@ import Tile = Phaser.Tilemaps.Tile;
|
|||
import {ITiledMap, ITiledTileSet} from "../Map/ITiledMap";
|
||||
import {cypressAsserter} from "../../Cypress/CypressAsserter";
|
||||
|
||||
export const GameSceneName = "GameScene";
|
||||
export enum Textures {
|
||||
Rock = 'rock',
|
||||
Player = 'playerModel',
|
||||
Map = 'map'
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface{
|
|||
|
||||
constructor() {
|
||||
super({
|
||||
key: "GameScene"
|
||||
key: GameSceneName
|
||||
});
|
||||
this.GameManager = gameManager;
|
||||
this.Terrains = [];
|
||||
|
|
|
@ -2,8 +2,7 @@ import {gameManager} from "../Game/GameManager";
|
|||
import {TextField} from "../Components/TextField";
|
||||
import {TextInput} from "../Components/TextInput";
|
||||
import {ClickButton} from "../Components/ClickButton";
|
||||
import {GameSceneInterface} from "../Game/GameScene";
|
||||
import {MessageUserPositionInterface} from "../../Connexion";
|
||||
import {GameSceneName} from "../Game/GameScene";
|
||||
|
||||
//todo: put this constants in a dedicated file
|
||||
export const LoginSceneName = "LoginScene";
|
||||
|
@ -11,7 +10,7 @@ enum LoginTextures {
|
|||
playButton = "play_button",
|
||||
}
|
||||
|
||||
export class LogincScene extends Phaser.Scene implements GameSceneInterface {
|
||||
export class LogincScene extends Phaser.Scene {
|
||||
private emailInput: TextInput;
|
||||
private textField: TextField;
|
||||
private playButton: ClickButton;
|
||||
|
@ -47,16 +46,7 @@ export class LogincScene extends Phaser.Scene implements GameSceneInterface {
|
|||
let email = this.emailInput.text;
|
||||
if (!email) return;
|
||||
gameManager.connect(email).then(() => {
|
||||
this.scene.start("GameScene");
|
||||
this.scene.start(GameSceneName);
|
||||
});
|
||||
}
|
||||
|
||||
Map: Phaser.Tilemaps.Tilemap;
|
||||
RoomId: string;
|
||||
|
||||
createCurrentPlayer(UserId: string): void {
|
||||
}
|
||||
|
||||
shareUserPosition(UsersPosition: Array<MessageUserPositionInterface>): void {
|
||||
}
|
||||
}
|
|
@ -67,27 +67,25 @@ export class Player extends PlayableCaracter implements CurrentGamerInterface, G
|
|||
let speedMultiplier = activeEvents.get(UserInputEvent.SpeedUp) ? 25 : 9;
|
||||
let moveAmount = speedMultiplier * delta;
|
||||
|
||||
let x = 0;
|
||||
let y = 0;
|
||||
if (activeEvents.get(UserInputEvent.MoveUp)) {
|
||||
this.move(0, -moveAmount);
|
||||
haveMove = true;
|
||||
y = - moveAmount;
|
||||
direction = PlayerAnimationNames.WalkUp;
|
||||
}
|
||||
if (activeEvents.get(UserInputEvent.MoveLeft)) {
|
||||
this.move(-moveAmount, 0);
|
||||
haveMove = true;
|
||||
direction = PlayerAnimationNames.WalkLeft;
|
||||
}
|
||||
if (activeEvents.get(UserInputEvent.MoveDown)) {
|
||||
this.move(0, moveAmount);
|
||||
haveMove = true;
|
||||
} else if (activeEvents.get(UserInputEvent.MoveDown)) {
|
||||
y = moveAmount;
|
||||
direction = PlayerAnimationNames.WalkDown;
|
||||
}
|
||||
if (activeEvents.get(UserInputEvent.MoveRight)) {
|
||||
this.move(moveAmount, 0);
|
||||
haveMove = true;
|
||||
if (activeEvents.get(UserInputEvent.MoveLeft)) {
|
||||
x = -moveAmount;
|
||||
direction = PlayerAnimationNames.WalkLeft;
|
||||
} else if (activeEvents.get(UserInputEvent.MoveRight)) {
|
||||
x = moveAmount;
|
||||
direction = PlayerAnimationNames.WalkRight;
|
||||
}
|
||||
if (!haveMove) {
|
||||
if (x !== 0 || y !== 0) {
|
||||
this.move(x, y);
|
||||
} else {
|
||||
direction = PlayerAnimationNames.None;
|
||||
this.stop();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue