feat: added keys for buff
This commit is contained in:
parent
3b0de4b789
commit
b59dc3e585
|
@ -27,7 +27,9 @@ import WeaponTypeRegistry from "./shattered_sword/Registry/WeaponTypeRegistry";
|
||||||
{name: "inventory", keys: ["i","b"]},
|
{name: "inventory", keys: ["i","b"]},
|
||||||
{name: "pause", keys: ["escape"]},
|
{name: "pause", keys: ["escape"]},
|
||||||
{name: "tab", keys: ["tab"]},
|
{name: "tab", keys: ["tab"]},
|
||||||
{name: "spawn", keys: ["q"]} //debug feature to test enemy spawning, press q to spawn enemy at current location
|
{name: "buff1", keys: ["1"]},
|
||||||
|
{name: "buff2", keys: ["2"]},
|
||||||
|
{name: "buff3", keys: ["3"]}
|
||||||
],
|
],
|
||||||
useWebGL: false, // Tell the game we want to use webgl
|
useWebGL: false, // Tell the game we want to use webgl
|
||||||
showDebug: false // Whether to show debug messages. You can change this to true if you want
|
showDebug: false // Whether to show debug messages. You can change this to true if you want
|
||||||
|
|
|
@ -418,6 +418,16 @@ export default class GameLevel extends Scene {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (InputWrapper.isBuff1JustPresed()) {
|
||||||
|
this.emitter.fireEvent("buff1");
|
||||||
|
}
|
||||||
|
if (InputWrapper.isBuff2JustPresed()) {
|
||||||
|
this.emitter.fireEvent("buff2");
|
||||||
|
}
|
||||||
|
if (InputWrapper.isBuff3JustPresed()) {
|
||||||
|
this.emitter.fireEvent("buff3");
|
||||||
|
}
|
||||||
|
|
||||||
//update health UI
|
//update health UI
|
||||||
let playerAI = (<PlayerController>this.player.ai);
|
let playerAI = (<PlayerController>this.player.ai);
|
||||||
this.healthLabel.text = "Health: "+ Math.round(playerAI.CURRENT_HP) +'/' + Math.round(playerAI.MAX_HP +playerAI.CURRENT_BUFFS.hp);
|
this.healthLabel.text = "Health: "+ Math.round(playerAI.CURRENT_HP) +'/' + Math.round(playerAI.MAX_HP +playerAI.CURRENT_BUFFS.hp);
|
||||||
|
@ -462,36 +472,6 @@ export default class GameLevel extends Scene {
|
||||||
const baseViewportSize = this.viewport.getHalfSize().scaled(2);
|
const baseViewportSize = this.viewport.getHalfSize().scaled(2);
|
||||||
//check position of player
|
//check position of player
|
||||||
this.playerFalloff(viewportCenter, baseViewportSize);
|
this.playerFalloff(viewportCenter, baseViewportSize);
|
||||||
|
|
||||||
// Update player safe position
|
|
||||||
// if (this.player.onGround) {
|
|
||||||
// this.playerSpawn = this.player.position.clone();
|
|
||||||
// }
|
|
||||||
|
|
||||||
//TODO - this is for testing
|
|
||||||
/*
|
|
||||||
if(InputWrapper.isSpawnJustPressed()){
|
|
||||||
console.log("trying to spawn enemy");
|
|
||||||
this.addEnemy("test_dummy",this.player.position,{player: this.player,
|
|
||||||
health :100,
|
|
||||||
tilemap: "Main",
|
|
||||||
//actions:actions,
|
|
||||||
goal: Statuses.REACHED_GOAL,
|
|
||||||
actions: [new AttackAction(3, [Statuses.IN_RANGE], [Statuses.REACHED_GOAL]),
|
|
||||||
new Move(2, [], [Statuses.IN_RANGE], {inRange: 60})],
|
|
||||||
status : [Statuses.CAN_RETREAT, Statuses.CAN_BERSERK],
|
|
||||||
weapon : this.createWeapon("knife")
|
|
||||||
});
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// if (InputWrapper.isInventoryJustPressed()) {
|
|
||||||
// console.log("LoadingStory");
|
|
||||||
// this.storyLoader("shattered_sword_assets/jsons/story.json");
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO put UI changes in here
|
// TODO put UI changes in here
|
||||||
|
|
|
@ -3,12 +3,14 @@ import Label from "../../Wolfie2D/Nodes/UIElements/Label";
|
||||||
import { UIElementType } from "../../Wolfie2D/Nodes/UIElements/UIElementTypes";
|
import { UIElementType } from "../../Wolfie2D/Nodes/UIElements/UIElementTypes";
|
||||||
import Scene from "../../Wolfie2D/Scene/Scene";
|
import Scene from "../../Wolfie2D/Scene/Scene";
|
||||||
import Color from "../../Wolfie2D/Utils/Color";
|
import Color from "../../Wolfie2D/Utils/Color";
|
||||||
|
import { GameState } from "../sword_enums";
|
||||||
import InputWrapper from "../Tools/InputWrapper";
|
import InputWrapper from "../Tools/InputWrapper";
|
||||||
import MainMenu from "./MainMenu";
|
import MainMenu from "./MainMenu";
|
||||||
|
|
||||||
export default class GameOver extends Scene {
|
export default class GameOver extends Scene {
|
||||||
|
|
||||||
startScene() {
|
startScene() {
|
||||||
|
InputWrapper.setState(GameState.PAUSE);
|
||||||
const center = this.viewport.getCenter();
|
const center = this.viewport.getCenter();
|
||||||
|
|
||||||
this.addUILayer("primary");
|
this.addUILayer("primary");
|
||||||
|
|
|
@ -103,15 +103,25 @@ export default class InputWrapper {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static isSpawnJustPressed(): boolean {
|
static isBuff1JustPresed(): boolean{
|
||||||
if (InputWrapper.gameState != GameState.GAMING) {
|
if (InputWrapper.gameState != GameState.BUFF) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return Input.isJustPressed("buff1");
|
||||||
|
}
|
||||||
|
|
||||||
if (Input.isJustPressed("spawn")) {
|
static isBuff2JustPresed(): boolean{
|
||||||
return true;
|
if (InputWrapper.gameState != GameState.BUFF) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
return Input.isJustPressed("buff2");
|
||||||
|
}
|
||||||
|
|
||||||
|
static isBuff3JustPresed(): boolean{
|
||||||
|
if (InputWrapper.gameState != GameState.BUFF) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Input.isJustPressed("buff3");
|
||||||
}
|
}
|
||||||
|
|
||||||
static isPauseJustPressed(): boolean {
|
static isPauseJustPressed(): boolean {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user