Open Auroriax opened 1 year ago
these both seem nice! if you'd like, I can send you my code I used to merge in the 3d effect stuff for my butter game. iirc the main thing was that the spritesheet is packed into one canvas, but variably-sized sprites break some assumptions there, so what I ended up doing was creating individual extra canvases for every irregular sprite. and then I created a global dictionary to track where each sprite number was located. basically this, plus a whole lot of extra fiddling around:
if (sprites[i].dat.length === state.sprite_size) {
// normal sprite
if (canOpenEditor) {
spriteimages[i] = createSprite(i.toString(),sprites[i].dat, sprites[i].colors);
}
var spriteX = (i % spritesheetSize)|0;
var spriteY = (i / spritesheetSize)|0;
renderSprite(spritesheetContext, sprites[i].dat, sprites[i].colors, 0, spriteX, spriteY);
sprites[i].canvas=spritesheetCanvas
sprites[i].sx=spriteX * cellwidth
sprites[i].sy=spriteY * cellheight
sprites[i].sw=cellwidth
sprites[i].sh=cellheight
sprites[i].oy=0
// console.log("normal",i)
} else {
// tall sprite
var name=i.toString()
var tallheight = cellheight * sprites[i].dat.length / state.sprite_size
// the only place the overide params are used:
var canv=createSprite(name,sprites[i].dat, sprites[i].colors,0,cellwidth,tallheight);
// assert(precanv==canv)
spriteimages[i] = canv
sprites[i].canvas=canv
sprites[i].sx=0
sprites[i].sy=0
sprites[i].sw=cellwidth
sprites[i].sh=tallheight
sprites[i].oy=cellheight - canv.height
// console.log("tall",name,canv.width,canv.height);
}
Yes, please do! 3D effects seem like a common use case for PuzzleScript so I'd like to support them. I don't think it's super important that the 3D sprites are optimized, so this solution would be perfect.
hm, github won't let me fork this repo (I think because I already forked increpare's repo?) so I'm not sure how to send a PR. I know I can create a "patch" with git and send that file to you (pastebin/email?), unless you have some other idea?
Yeah, I had this issue with another contributor previously (#16) and didn't manage to solve it then. I think you're supposed to add this as an origin locally then branch out from there and use that to make a PR, but I haven't tried it.
A patch file would also be fine, I think you can just attach files to these issue comments. I'm also in the Thinky Puzzle Games discord if you want to discuss things or drop files there. (For my email see auroriax.com)
ah, that worked great! #82
Can we rename/split this for each fork?
I'm happy to tackle the issue, but someone needs to provide test program(s).
MML
https://github.com/competor/PuzzleScript-MML
This is a really nifty way of defining audio (both sfx and music!) that plays really well into PuzzleScript's strengths. They've also done some nice quality of life features, including a greatly expanded amount of sound effects.
Pseudo-3D effect
https://github.com/broken-sign-games/PuzzleScript/
And look through the list at https://pedros.works/game-tools.html for other features that might be interesting.