Now that I'm looking at Engine BASIC again, I thought I'd ask how I might solve my problem of moving cards (larger than 32 x 32, and more that 32) smoothly around the screen.
I want to have playing cards move to where they are dealt, and flip over when required.
To do this, I either need more and larger sprites, or maybe be able to 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.
Reading through the Reference Manual, I am having trouble seeing how I can do this.
Any ideas?
This is about as good as I could manage with MMBasic on the PicoMiteVGA.
Playing Card Animation on Twitter
You can see that at this stage, MMBasic had difficulties with an ALPHA channel. After this demo, it was hard coded to BLACK which I didn't like much, specially when the PicoMiteVGA has such a limited colour palette. If I had to give up a colour, and couldn't choose at runtime, then I'd much rather give up hot pink!

  • uli replied to this.

    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.

    Wow…now there’s a solution I can work with.
    The easiest way to implement cards is to make each one a sprite.
    Now I can give it a go. I need to dig out one of my H3 boards and upgrade my Engine BASIC.

    Powered by: FreeFlarum.
    (remove this footer)