Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 10:52 26 Nov 2024 Privacy Policy
Jump to

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: Australia
Posts: 47
Posted: 06:52am 26 Feb 2024
Copy link to clipboard 
Print this post

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: Netherlands
Posts: 4233
Posted: 07:07am 26 Feb 2024
Copy link to clipboard 
Print this post

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: Australia
Posts: 47
Posted: 07:20am 26 Feb 2024
Copy link to clipboard 
Print this post

Awesome! Many thanks Volhout.  
Edited 2024-02-26 17:43 by MarkF
 
LeoNicolas

Guru

Joined: 07/10/2020
Location: Canada
Posts: 479
Posted: 04:52pm 26 Feb 2024
Copy link to clipboard 
Print this post

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: Australia
Posts: 47
Posted: 09:16am 27 Feb 2024
Copy link to clipboard 
Print this post

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: Canada
Posts: 479
Posted: 03:24pm 27 Feb 2024
Copy link to clipboard 
Print this post

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


To reply to this topic, you need to log in.

© JAQ Software 2024