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

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

View File

@ -35,7 +35,6 @@ export default class OnGround extends PlayerState {
this.finished("fall"); this.finished("fall");
} }
super.update(deltaT); 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 GameNode from "../../../Wolfie2D/Nodes/GameNode";
import Sprite from "../../../Wolfie2D/Nodes/Sprites/Sprite"; import Sprite from "../../../Wolfie2D/Nodes/Sprites/Sprite";
import Timer from "../../../Wolfie2D/Timing/Timer"; 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 InputWrapper from "../../Tools/InputWrapper";
import PlayerController from "../PlayerController"; 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.emitter.fireEvent(Player_Events.PLAYER_MOVE, {position: this.owner.position.clone()});
this.positionTimer.start(); this.positionTimer.start();
} }
this.parent.velocity.y += this.gravity*deltaT;
if(InputWrapper.isDashJustPressed()){ if(InputWrapper.isDashJustPressed()){
this.doDash(); this.doDash();
@ -70,5 +70,9 @@ export default abstract class PlayerState extends State {
if (!PlayerState.dashTimer.isStopped()) { if (!PlayerState.dashTimer.isStopped()) {
this.parent.velocity.x = (<Sprite>this.owner).invertX ? -800 : 800; 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 Layer from "../../Wolfie2D/Scene/Layer";
import Label from "../../Wolfie2D/Nodes/UIElements/Label"; import Label from "../../Wolfie2D/Nodes/UIElements/Label";
import MainMenu from "./MainMenu"; import MainMenu from "./MainMenu";
import SceneWithStory from "./SceneWithStory";
import Tutorial from "./Tutorial"; import Tutorial from "./Tutorial";
@ -123,10 +122,6 @@ export default class Levels extends Scene {
this.sceneManager.changeToScene(MainMenu, {}); this.sceneManager.changeToScene(MainMenu, {});
} }
if(event.type === "StorySceneTester"){
this.sceneManager.changeToScene(SceneWithStory, {});
}
if(event.type === "back"){ if(event.type === "back"){
this.sceneManager.changeToScene(MainMenu, {}); this.sceneManager.changeToScene(MainMenu, {});
} }