Skip to content

Conversation

@qindongliang
Copy link

Description

This PR fixes a bug where switch costume to [0] blocks were incorrectly transpiled as this.costume = 0 (integer), causing Leopard to interpret it as a costume index rather than a costume name.

In Leopard (and Scratch):

  • Integer 0: Interpreted as a 1-based index with wrapping, which resolves to the last costume in the list.
  • String "0": Interpreted as a costume name, correctly finding the costume named "0".

By changing the InputShape for looks_switchcostumeto from Any to String, the transpiler now generates this.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".

  • Before: Transpiled code used this.costume = 0, causing the sprite to render the wrong costume (index 16).
  • After: Transpiled code uses this.costume = "0", correctly rendering the first costume.

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.
- 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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant