Skip to content

wip merge pseudo-3d effect from broken-sign-games #82

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
wants to merge 1 commit into
base: master
Choose a base branch
from

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