feat: Implement local play mode and add example dash move#2
Open
xflwx wants to merge 1 commit intoSuloch:mainfrom
Open
feat: Implement local play mode and add example dash move#2xflwx wants to merge 1 commit intoSuloch:mainfrom
xflwx wants to merge 1 commit intoSuloch:mainfrom
Conversation
This commit introduces a local play mode, allowing two players to play on the same machine with separate keyboard controls. It also adds an example "dash" move to demonstrate how new moves can be developed and tested in this local environment.
Key changes:
- Modified `game.ts`:
- Added a `localPlay` flag to the `GameWindow` class.
- When `localPlay` is true, the game bypasses network setup and starts directly with two local players.
- Modified `input.ts`:
- Updated the `Input` class to support different key mappings for two players.
- Player 1 uses WASD for movement, UIJK for actions, and 'C' for dash.
- Player 2 uses Arrow keys for movement, Numpad 4512 for actions, and 'Numpad3' for dash.
- Added a new `dash` input to the `InputBuffer`.
- Modified `player.ts`:
- Added a "dash" move with cooldown, duration, and specific movement logic (horizontal dash with no gravity during the dash).
- Modified `main.ts`:
- Set `localPlay` to true by default for easier testing of local mode.
This allows developers to create and test new moves and game mechanics without needing to connect to another client.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit introduces a local play mode, allowing two players to play on the same machine with separate keyboard controls. It also adds an example "dash" move to demonstrate how new moves can be developed and tested in this local environment.
Key changes:
game.ts:localPlayflag to theGameWindowclass.localPlayis true, the game bypasses network setup and starts directly with two local players.input.ts:Inputclass to support different key mappings for two players.dashinput to theInputBuffer.player.ts:main.ts:localPlayto true by default for easier testing of local mode.This allows developers to create and test new moves and game mechanics without needing to connect to another client.