Skip to content

feat: Implement local play mode and add example dash move#2

Open
xflwx wants to merge 1 commit intoSuloch:mainfrom
xflwx:feature/local-play-and-dash-move
Open

feat: Implement local play mode and add example dash move#2
xflwx wants to merge 1 commit intoSuloch:mainfrom
xflwx:feature/local-play-and-dash-move

Conversation

@xflwx
Copy link

@xflwx xflwx commented Jun 15, 2025

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 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.
@xflwx xflwx closed this Jun 15, 2025
@xflwx xflwx reopened this Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant