For starters, you might want to look at BLIT
: https://basicengine.org/manual.html#_blit
Hawk copy a potion of the screen into a sprite, move it to the appropriate location while preserving what is under the sprite, and then changing the data of the sprite if it is to be flipped, then saving the data under the sprite, then copying the sprite data to the screen.
That should all be achievable using BLIT
.
(FTR, the graphics subsystem works differently on NG+ systems than it did on the OG BASIC Engine; the "text" screen (which both text output and the pixel graphics commands, including BLIT
, draw to) is a separate layer and is not overwritten by sprite and background rendering. You don't have to do anything special to preserve the text screen when moving sprites around.)
I did something vaguely similar in the Sokoban demo with animations. I use a tiled background for the entire playfield (including the crates), and I make the crates a sprite only while they are in motion, and once they are in place I set the background tile to the same graphics and disable the sprite.
The other option is to remind ourselves that unlike other projects we're not using parts from Grampa's junk drawer (anymore), and just increase the limits. Which I have just done. From the next build, there will be 128 sprites with a maximum size of 1024x1024, and 16 background layers with a maximum map size of 255x255 and a maximum tile size of 255x255. (These numbers are quite arbitrary, so if anybody has a use case for more...)
As usual, most of this is pretty untested, so tell me if something doesn't work.