Skip to content

Commit

Permalink
toLeopard: serialize initial rotation style
Browse files Browse the repository at this point in the history
  • Loading branch information
towerofnix committed Jul 24, 2023
1 parent 4ad5ab0 commit 236f739
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/io/leopard/toLeopard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1885,7 +1885,7 @@ export default function toLeopard(
</html>
`,
"index.js": `
import { Project } from ${JSON.stringify(toLeopardJS({ from: "index" }))};
import { Project, Sprite } from ${JSON.stringify(toLeopardJS({ from: "index" }))};
${[project.stage, ...project.sprites]
.map(
Expand All @@ -1900,15 +1900,24 @@ export default function toLeopard(
${project.sprites
.map(
sprite =>
`${sprite.name}: new ${sprite.name}(${JSON.stringify({
`${sprite.name}: new ${sprite.name}({${Object.entries({
x: sprite.x,
y: sprite.y,
direction: sprite.direction,
rotationStyle: `Sprite.RotationStyle.${
{
normal: "ALL_AROUND",
leftRight: "LEFT_RIGHT",
none: "DONT_ROTATE"
}[sprite.rotationStyle]
}`,
costumeNumber: sprite.costumeNumber + 1,
size: sprite.size,
visible: sprite.visible,
layerOrder: sprite.layerOrder
})})`
})
.map(([key, value]) => `${key}:${value}`)
.join(",")}})`
)
.join(",\n")}
};
Expand Down

0 comments on commit 236f739

Please sign in to comment.