Skip to content

Add special abilities, commented out by default#44

Merged
wjt merged 4 commits into
mainfrom
specials
Nov 27, 2025
Merged

Add special abilities, commented out by default#44
wjt merged 4 commits into
mainfrom
specials

Conversation

@wjt
Copy link
Copy Markdown
Member

@wjt wjt commented Nov 19, 2025

No description provided.

@github-actions
Copy link
Copy Markdown

Play this branch at https://endlessm.github.io/moddable-platformer/branches/endlessm/specials.

(This launches the game from the start, not directly at the change(s) in this pull request.)

@wjt
Copy link
Copy Markdown
Member Author

wjt commented Nov 19, 2025

@jgbourque this is incomplete (no shrink action yet) but please test and give feedback:

  • What do you think about the keybindings?
  • Do these three work like you imagined?
  • If you look at the code, does this seem teachable?

@wjt
Copy link
Copy Markdown
Member Author

wjt commented Nov 20, 2025

The keybindings are difficult in part because we want to support two players on a single (laptop!) keyboard, so the P1 and P2 bindings need to be constrained to the right and left (respectively) of the keyboard. This also means we can't use alphabetical mnemonics such as T for teleport; and since we have actions you need to hold down, they need to be far enough apart that you can potentially control the arrows with one hand and the actions with the other.

So far we have limited ourselves to the arrow keys and WAD; with the exception of AZERTY in Francophone countries (and nerds like me who use Dvorak), WAD are in the same place on all latin-alphabet-based languages' keyboards, and to the best of my knowledge keyboards for other scripts such as cyrillic and arabic are often dual-labelled with QWERTY labels (so WAD are labelled in the correct places on those). But if we need more actions then we need to pick more keys.

One option is to e.g. bind the two shifts to player 1 and player 2's teleport action (for example). But then we have to carefully show in the HUD that it is right-shift for P1 and left-shift for P2. (Another option would be to make the player controllable by BOTH inputs by default, in which case both shifts would work.)

@wjt wjt force-pushed the specials branch 3 times, most recently from 345c804 to 8d5af58 Compare November 24, 2025 11:43
wjt added 4 commits November 26, 2025 15:55
If the player holds down the "jump" action, their character's downwards
speed is capped to a constant. This allows the player-character to
travel across wider gaps by jumping then gliding.

The function call for this ability is in _physics_process(), after other
"normal" adjustments to the velocity but before move_and_slide().
However, it is commented out. A learner must find this commented-out
line and uncomment it to enable this ability.

The sound effect is from
https://freesound.org/people/tothrec2/sounds/596541/, licensed under
CC0-1.0.
If the player enters this action while also holding left or right, the
player-character teleports by a constant distance horizontally.

On keyboard, this is bound to "Enter" for player 1 (who moves with the
arrow keys), and "Shift" for player 2 (who moves with WASD).

On gamepad, this is bound to Xbox button B.

The function call for this ability is in the correct place in
_physics_process() but is commented out. A learner must find this
commented-out line and uncomment it to enable this ability.

The sound effect is https://freesound.org/people/D.S.G./sounds/244654/
(CC0-1.0).
This adds an action that, while held, temporarily prevents the
player-character from colliding with enemies or coins.

The new action is bound to:

- Player 1: Backspace
- Player 2: Tab
- Gamepad: Xbox X / PlayStation Square

As with the other new actions, the function call to implement this is
commented out.
As with the other special abilities, the function call in
_physics_process() that implements this ability is commented out.
@wjt wjt marked this pull request as ready for review November 26, 2025 15:56
@wjt wjt requested a review from a team as a code owner November 26, 2025 15:56
@wjt
Copy link
Copy Markdown
Member Author

wjt commented Nov 26, 2025

Having discussed this with @jgbourque, I have revised this PR to only add the new abilities, without updating the HUD to show the inputs for the new actions, tweaking the world to require these abilities to reach new spaces, or adding hints in the world. I'll do those in follow-up PRs.

I added more thorough comments to the code & constants, along with some strategically-placed FIXMEs with ideas for how these specials could be improved.

@wjt
Copy link
Copy Markdown
Member Author

wjt commented Nov 27, 2025

I'm going to go ahead and merge these since Justin said before going away on PTO that these meet his requirements.

@wjt wjt merged commit e72401f into main Nov 27, 2025
6 checks passed
@wjt wjt deleted the specials branch November 27, 2025 18:34
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