-
Notifications
You must be signed in to change notification settings - Fork 16
fix(toLeopard): cast switch costume input to string #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
qindongliang
wants to merge
16
commits into
leopard-js:master
Choose a base branch
from
qindongliang:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
This prevents an issue where a costume named '0' is interpreted as the integer 0. In Leopard/Scratch, the integer 0 as a costume index triggers wrapping logic (selecting the last costume), whereas the string '0' correctly selects the costume by name.
…prite name aliases for variable lookups
…ing and update .gitignore
- Replace '?' with '_' in asset filenames for URL safety - Apply sanitization in both file export (cli/index.ts) and generated JS paths (toLeopard.ts) - Update conversion workflow to sanitize output directory names
… switcher - Implement fullscreen responsive layout with CSS flexbox and object-fit: contain. - Move Green Flag button to absolute position within project container. - Add background theme switcher UI with persistent storage (Pitch Black, Dark Gray, Light Gray, Eye Comfort Green). - Update Stage initialization to use 600x440 dimensions for better aspect ratio coverage.
- Inject #ui-folder button for toggling UI visibility. - Implement CSS logic for .ui-folded state to hide Green Flag and Fullscreen buttons. - Apply transform: scale(1.2) translateY(-8%) to canvas in folded state to crop game's top menu bar. - Add fullscreen toggle button logic.
- Add #immersive-mask div to cover top menu bar in folded state. - Remove canvas transform: scale/translate to preserve layout integrity. - Ensure fold toggle auto-hides (opacity: 0) and shows on hover. - Move fold button and mask inside #project for Fullscreen API support.
- Replace canvas cropping with black mask overlay for menu bar coverage - Change #ui-folder from position:fixed to position:absolute (inside stage) - Remove auto-hide behavior for fold button (always visible) - Fix JS duplicate const declaration causing script failure - Increase mask height to 15% for full menu bar coverage
- Add --sprunki-mode CLI parameter option - Add sprunkiMode property to ToLeopardOptions interface - Inject conditional CSS variable when Sprunki mode is enabled - Prepares foundation for Phase 2 full-body character display
- Add --sprunki-mode CLI parameter for Sprunki/Incredibox mods - Implement post-processing to remap Icons sprite goto() coordinates - Replace original misaligned positions with 10-column grid layout - Coordinates sorted and redistributed: 48px spacing, y=140 base - Enables consistent aligned icon display across all Sprunki mods
- Introduced `sprunkiMode.ts` to handle Sprunki-specific transformations. - Implemented global layer fix: automatic Z-index boosting (+35) for characters to prevent background occlusion. - Implemented adaptive icon grid: 10-column layout with 46px spacing to fill 480px stage. - Added smart clone counting logic to ensure all 32 icons are rendered despite loop ambiguity. - Integrated transformations into `toLeopard.ts` via `--sprunki-mode` flag.
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.
Description
This PR fixes a bug where
switch costume to [0]blocks were incorrectly transpiled asthis.costume = 0(integer), causing Leopard to interpret it as a costume index rather than a costume name.In Leopard (and Scratch):
0: Interpreted as a 1-based index with wrapping, which resolves to the last costume in the list."0": Interpreted as a costume name, correctly finding the costume named "0".By changing the
InputShapeforlooks_switchcostumetofromAnytoString, the transpiler now generatesthis.costume = "0", ensuring the intended costume is selected by name.Issue Fixed
Fixes an issue where sprites would unexpectedly switch to the last costume (often causing visual artifacts like "stretching" if the last costume is a specific animation frame) when the intention was to switch to the first costume named "0".
Verification
Tested with a Scratch project ("Sprunked") that uses a costume named "0".
this.costume = 0, causing the sprite to render the wrong costume (index 16).this.costume = "0", correctly rendering the first costume.