Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Sprites and artifacts - same layer
Author | Message | ||||
MarkF Regular Member Joined: 01/08/2023 Location: AustraliaPosts: 47 |
Hi. I am using the PicoMite VGA. I have two (2) sprites on the same layer. If I code several movements to the x position of one of the sprites to move it over then leave the 2nd sprite, artifacts are left behind. What would be the best way to fix this please? 1) Use a special combination of sprite show and hide? 2) Maybe mix in sprite show safe and/or sprite hide safe? 3) Put the sprites on separate layers? But then I'm limited to 10 layers / sprites. Thanks |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4233 |
Hi Mark, Your explanation is quite clear, but it would help to see the code that shows the artefact, so we can pinpoint where the changeneeds to be made. But in General: framebuffer create framebuffer write f 'default starting point sprite show 2 sprite show 1 Do hide sprite 1 hide sprite 2 'order of sprites is inportant calculate new sprite positions show sprite 2 show sprite 1 framebuffer copy f,n pause 100 'to slow down... loop Volhout Edited 2024-02-26 17:12 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
MarkF Regular Member Joined: 01/08/2023 Location: AustraliaPosts: 47 |
Awesome! Many thanks Volhout. Edited 2024-02-26 17:43 by MarkF |
||||
LeoNicolas Guru Joined: 07/10/2020 Location: CanadaPosts: 479 |
I recommend you use sprite next and sprite move to execute the sprite movement in batch. You can leave sprite show safe and sprite hide safe only to the moment you need to hide and show them. In Knightmare, I'm also using two buffers, one for the background and another for the sprites. |
||||
MarkF Regular Member Joined: 01/08/2023 Location: AustraliaPosts: 47 |
Hey Leo. Thanks for the Sprite commands recommendations. I don't know if Sprite next and Sprite move restore the background when they are moved. I haven't tried a test to see if the bottom layers (background) are restored or not. |
||||
LeoNicolas Guru Joined: 07/10/2020 Location: CanadaPosts: 479 |
They do it. I have forgotten to mention, the sprites layers do not define the sprites order, it is used for collision detection. |
||||
Print this page |