Repository navigation
Conversation
A second platform player beside the first: "set X as player 2" promotes a sprite into a second player group, steered by W, A, S and D as the first is by the arrow keys, with the same physics and jump. "Player 2" refers to it as "the player" does. The engine treats both groups as players for gravity, footing and landing; the arrow-key player stays the one the sounds, objectives and camera follow. Both blocks are in the complete toolbox, the Platform additions and the free-play level's own toolbox, with catalog entries, so Discover blocks offers them. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The player groups move to playerGroups.ts, shared by the engine and the block code, and every block reads the group from it. One builder writes both players' key handlers. Jump take-off spots and the impulse frame are kept for the arrow-key player only, since only its jump event is raised, and the progress report no longer counts the other player as something touched. The block help says which player the events, sounds and camera follow. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This branch has not been deployed
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.
[written by Claude]
Summary
A new block, set X as player 2, makes a sprite a second platform player, moved with W, A, S and D while the first player keeps the arrow keys, so two people can play on one keyboard. It falls, lands and jumps like the first player, under the same gravity. A player 2 block refers to it the way the player does, so events can tell the two apart. Both blocks are in the toolboxes and in the free-play level's Discover blocks catalog.
Captures
Recording
Screen.Recording.2026-11-05.at.11.03.26.PM.mov
Code
Catalog
Key changes
setAsPlatformPlayer2andthePlayer2block definitions. One builder inmakePlatformPlayerwrites the key handlers for both players, so the two sets cannot drift; the new block's runtime half calls it with W, A, S and D and the second group.playerGroups.ts, shared by the engine and every block that names one.setPlatformPlayerandplatformJumpdefault to the first player's. Gravity, footing and landing apply to both groups; the sounds, objectives, jump event and camera still follow the arrow-key player, and the progress report does not count the other player as something touched.Testing
Unit tests for the new block's generated code and its key wiring, for the first player's keys staying its own, and the existing suites for toolboxes, catalog help, image references and the engine's helper code. Checked in the browser as a test student on the free-play level with a two-player program, reading sprite positions from the running game: holding A moved player 2 left and off its ledge while player 1 stood still, holding the right arrow moved player 1 while player 2 stood still, W jumped player 2 alone, and the up arrow jumped player 1 alone.