Issue with spriteslice? (Sample Programs)

by UglyMike ⌂ @, Brussels, Thursday, September 19, 2013, 11:07 (1376 days ago) @ Jim

Sure. Here it is:

fastgraphics
spritedim 3
# take a red splice
color red
rect 0,0,300,300
spriteslice 1,50,50,100,100
# take a blue splice
color blue
rect 0,0,300,300
spriteslice 2,75,25,25,100
# take a yellow splice
color yellow
rect 0,0,300,300
spriteslice 3,25,75,100,25
#make the canvas green
color green
rect 0,0,300,300
refresh
while 1=1
cls
print "Input a spritenumber (1, 2 or 3)"
input a
color green
rect 0,0,300,300
spriteplace a,150,150
spriteshow a
refresh
end while

If you give the input sequentially, no problem.
entering 1 shows only 1
entering 2 shows only 2
entering 3 shows only 3

After you entered a "higher" sprite, spriteshow of a lower one will always show the higher one as well but will hide any even-lower ones
entering 1 show 1, 2 and 3
entering 2 shows 2 and 3 but not 1
entering 3 shows only 3 but not 2 and 3

so yes, it looks like Z-buffering issue.

Of course if I do a spritehide of all sprites in my loop, then the issue goes away:
while 1=1
cls
print "Input a spritenumber (1, 2 or 3)"
input a
color green
rect 0,0,300,300
spritehide 1
spritehide 2
spritehide 3
spriteplace a,150,150
spriteshow a
refresh
end while

A bit of a pain though... If I overwrite a sprite (like here with the green) it should remain overwritten if I show another, lower-order sprite, no?


Complete thread:

 RSS Feed of thread

powered by my little forum