diff --git a/src/main.ts b/src/main.ts index eff57eb..1a486e2 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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 diff --git a/src/shattered_sword/Player/PlayerStates/Idle.ts b/src/shattered_sword/Player/PlayerStates/Idle.ts index e2cfa2d..e924742 100644 --- a/src/shattered_sword/Player/PlayerStates/Idle.ts +++ b/src/shattered_sword/Player/PlayerStates/Idle.ts @@ -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 { diff --git a/src/shattered_sword/Player/PlayerStates/InAir.ts b/src/shattered_sword/Player/PlayerStates/InAir.ts index 754a91f..ff67b6a 100644 --- a/src/shattered_sword/Player/PlayerStates/InAir.ts +++ b/src/shattered_sword/Player/PlayerStates/InAir.ts @@ -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); diff --git a/src/shattered_sword/Player/PlayerStates/OnGround.ts b/src/shattered_sword/Player/PlayerStates/OnGround.ts index fa0c518..f7c892e 100644 --- a/src/shattered_sword/Player/PlayerStates/OnGround.ts +++ b/src/shattered_sword/Player/PlayerStates/OnGround.ts @@ -35,7 +35,6 @@ export default class OnGround extends PlayerState { this.finished("fall"); } super.update(deltaT); - this.owner.move(this.parent.velocity.scaled(deltaT)); } diff --git a/src/shattered_sword/Player/PlayerStates/PlayerState.ts b/src/shattered_sword/Player/PlayerStates/PlayerState.ts index 2a46f09..0a5414c 100644 --- a/src/shattered_sword/Player/PlayerStates/PlayerState.ts +++ b/src/shattered_sword/Player/PlayerStates/PlayerState.ts @@ -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 = (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)); + } } } \ No newline at end of file diff --git a/src/shattered_sword/Scenes/Levels.ts b/src/shattered_sword/Scenes/Levels.ts index 003d001..81f5a09 100644 --- a/src/shattered_sword/Scenes/Levels.ts +++ b/src/shattered_sword/Scenes/Levels.ts @@ -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, {}); }