Skip to content

Conversation

@pancelor
Copy link

@pancelor pancelor commented Feb 8, 2023

the code's a bit of a mess; it was never meant to last longer than the one game I made it for. but this is the basics of how I merged the 3d effect from https://github.com/broken-sign-games/PuzzleScript/ into PSP for my butter game

I don't intend for this to be merged as-is, and I don't currently have plans to work on it more. hopefully this will be a helpful starting point if you decide to take this up!

canvasdict[name]=canvas;
if (!(name in canvasdict)) {
canvasdict[name]=document.createElement('canvas');
canvasdict[name].width = cellwidth;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the important bit here is that the canvas only gets resized on creation, not every time we get it

sprites[i].sw=cellwidth
sprites[i].sh=tallheight
sprites[i].oy=cellheight - canv.height
// console.log("tall",name,canv.width,canv.height);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the meat of the change - the sprites are packed into a fixed-size spritesheet, but we want to make variably-sized sprites. so, just create a new entire spritesheet for each one. and then for all sprites, track which spritesheet they come from (using the sprites table)

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