fix: remove storytester and freeze gravity when pausing

This commit is contained in:
Renge 2022-04-17 19:52:01 -04:00
parent 9e979b6fe7
commit 1a05c73f8e
6 changed files with 7 additions and 11 deletions

View File

@ -26,7 +26,7 @@ import WeaponTypeRegistry from "./shattered_sword/Registry/WeaponTypeRegistry";
{name: "skill", keys: ["l","v"]},
{name: "inventory", keys: ["i","b"]},
{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
],
useWebGL: false, // Tell the game we want to use webgl

View File

@ -23,7 +23,6 @@ export default class Idle extends OnGround {
this.parent.velocity.x = 0;
super.update(deltaT);
this.owner.move(this.parent.velocity.scaled(deltaT));
}
onExit(): Record<string, any> {

View File

@ -17,7 +17,6 @@ export default abstract class InAir extends PlayerState {
this.parent.velocity.x += dir.x * (this.parent.speed+this.parent.CURRENT_BUFFS.speed)/3.5 - 0.3*this.parent.velocity.x;
this.owner.move(this.parent.velocity.scaled(deltaT));
if(this.owner.onGround){
this.finished(PlayerStates.PREVIOUS);

View File

@ -35,7 +35,6 @@ export default class OnGround extends PlayerState {
this.finished("fall");
}
super.update(deltaT);
this.owner.move(this.parent.velocity.scaled(deltaT));
}

View File

@ -5,7 +5,7 @@ import GameEvent from "../../../Wolfie2D/Events/GameEvent";
import GameNode from "../../../Wolfie2D/Nodes/GameNode";
import Sprite from "../../../Wolfie2D/Nodes/Sprites/Sprite";
import Timer from "../../../Wolfie2D/Timing/Timer";
import { Player_Events } from "../../sword_enums";
import { GameState, Player_Events } from "../../sword_enums";
import InputWrapper from "../../Tools/InputWrapper";
import PlayerController from "../PlayerController";
@ -62,7 +62,7 @@ export default abstract class PlayerState extends State {
this.emitter.fireEvent(Player_Events.PLAYER_MOVE, {position: this.owner.position.clone()});
this.positionTimer.start();
}
this.parent.velocity.y += this.gravity*deltaT;
if(InputWrapper.isDashJustPressed()){
this.doDash();
@ -70,5 +70,9 @@ export default abstract class PlayerState extends State {
if (!PlayerState.dashTimer.isStopped()) {
this.parent.velocity.x = (<Sprite>this.owner).invertX ? -800 : 800;
}
if (InputWrapper.getState() === GameState.GAMING) {
this.parent.velocity.y += this.gravity*deltaT;
this.owner.move(this.parent.velocity.scaled(deltaT));
}
}
}

View File

@ -11,7 +11,6 @@ import Color from "../../Wolfie2D/Utils/Color";
import Layer from "../../Wolfie2D/Scene/Layer";
import Label from "../../Wolfie2D/Nodes/UIElements/Label";
import MainMenu from "./MainMenu";
import SceneWithStory from "./SceneWithStory";
import Tutorial from "./Tutorial";
@ -123,10 +122,6 @@ export default class Levels extends Scene {
this.sceneManager.changeToScene(MainMenu, {});
}
if(event.type === "StorySceneTester"){
this.sceneManager.changeToScene(SceneWithStory, {});
}
if(event.type === "back"){
this.sceneManager.changeToScene(MainMenu, {});
}