I've run into what looks like a bug:
If I use the DeleteAllSprites() command, the sprites are deleted, but stay on screen. No syncing or use of clearscreen() gets rid of them.
If I use DeleteSprite() and iterate through all sprites then it works just fine.
I also ran into a bump with using GetSpriteExists() in a for-next loop. It causes a stack overflow in my compiler for a reason I cannot determine. Bonus points to whoever can tell me what I'm doing wrong.
Compiled program and files (Windows) in the attached RAR.
Code below.
Thanks!!!
// A test of the DeleteAllSprites() function
// It appears to delete the sprite from memory,
// but sprites remain on screen even after Sync()
ring_image = loadimage("ring.png")
for c = 101 to 110
createsprite(c,ring_image)
setspritesize(c,10,-1)
setspriteposition(c,random(0,90),random(0,90))
next c
print("Press A to use DeleteAllSprites()")
print("Press B to use DeleSprite(sprite_num) iteration")
sync()
valid_input = 0
repeat
key_pressed = getrawlastkey()
if key_pressed = 65 or key_pressed = 66
valid_input = 1
endif
until valid_input = 1
select key_pressed
case 65:
deleteallsprites()
if getspriteexists(101)
print("sprite 101 still there")
else
print("sprite 101 deleted")
endif
sync()
sleep(1000)
endcase
case 66:
for d = 101 to 110
deletesprite(d)
next d
endcase
case default
print("There has been an error in my holomatrix!")
endcase
endselect
REMSTART
//for some reason this loop is causing a stack overflow...
for i = 101 to 110
if getspriteexists(i)
print("Sprite "+i+" still exists")
else
print("Sprite "+i+" has been deleted")
endif
next i
REMEND
print("Press ESC to exit")
sync()
repeat
until getrawkeypressed(27) = 1
END