10th May 2021
Wasn't expecting to be doing this, today..
I've tried a whole bunch of things to get everything running a little bit smoother, but between my terrible drawing functions, and the whole "hey, it's a script, and it's parsing it.. What can you do?" speed of JSE, it's kinda crummy when it comes to drawing backgrounds.
A tilemap engine.
Don't expect miracles, but do allow yourself to doodle some backgrounds and whatnot.
You can specify a size for the tilemap, up to 256x256 tiles in size, though it's not currently very well optimised for anything above 64x64.
Set tiles with SetTile(x,y,Symbol)
SetTileColor(x,y,Colour) can be used, using the Symbol colours.
SetTileRotation(x,y,Angle), SetTileOffset(x,y,OffsetX,OffsetY), SetTileAlpha(x,y,Alpha)
There's also a really handy SetTileData(x,y,"Whatever you want") thing, too..
You can then read tiles back with GetTile(x,y), GetTileData(x,y), GetTileColor, GetTileRotation, etc.
All tiles are 32x32 pixels in size.., a standard Symbol sprite.
Drawing is a little bit quirky, but when you say DrawTilemap(x,y), the x,y value will be the middle of the top-left tile..
That means if you DrawTilemap(0,0), then DrawImg(32,32,PlayerSprite) the Player will be offset, and standing on the tile at 1,1..
.. if that makes sense..?
DrawTilemap (and the accompanying WrapTilemap) both respect Scale and Alpha
I'd like to add Rotation, but that screws the numbers up even more. We'll see if I can manage it, in the future.
I now need to add a bunch of collision style functions to work with everything, I reckon.
If you've any suggestions, be sure to let me know.