Im totaly missing... With this try i can see after deleteallsprite , a deleted sprite, not created exist. (It create 1 chance on 2 with random, with deleteallsprite it alway created) , with deletesprite it work normally ...
SetClearColor(40,150,250)
setprintcolor(255,10,10,255)
//--------------------------------------------------------------
LoadImage(1, "img.png")
global spr4
spr1=CreateSprite(1)
spr3=clonesprite(spr1)
LoadImage(2, "img.png")
spr2=CreateSprite(2) : SetSpriteX(spr2, 100)
click_step=0
do
print("id1: " +str(spr1)+" existe: "+str(getspriteexists(spr1)))
print("id2: " +str(spr2)+" exist: "+str(getspriteexists(spr2)))
print("id3: " +str(spr3)+" exist: "+str(getspriteexists(spr3)))
print("id4: " +str(spr4)+" exist: "+str(getspriteexists(spr4)))
if GetPointerPressed()=1
select click_step
case 0:
//deletesprite (spr1):deletesprite (spr2):deletesprite (spr3):deletesprite (spr4):
deleteallsprites()
inc click_step
endcase
case 1:
spr1=CreateSprite(1)
spr2=CreateSprite(2) : SetSpriteX(spr2, 100)
if random (1,5)=2 then spr3=clonesprite(spr1)
spr4=clonesprite(spr1)
click_step = 0
endcase
endselect
endif
Sync()
loop
---->id dont exist, but it still have the same id value, so the system say it exist, but it not, because i think deleteallsprite reset value only when it created again, mysprite=createsprite(1) (maybe mysprite=100001), deleteallsprite (), (i think mysprite is still =100001) , mysprite=createsprite(1) (and now i think mysprite get a new value), then , when i try to know if a sprite exists, if he as be deletebefore by "deleteallsprite" , it can be an other sprite id with same value exist, deleted, but this sprite dont have same name id. I think i get it now ! (maybe its a problem when we use deleteallsprite the ID values are not already reset, but the counter)
Final solution
---->
going to still use deleteallsprite but mixed with call this function :
function resetarray (arr ref as integer[] )
memo=arr.length
arr.length=-1
arr.length=memo
endfunction
function deleteallsprites2()
deleteallsprites()
resetarray (cadreperso):resetarray (matombe):resetarray (cadreperso):fond=0:fonds=0:fondo=0:avatar=0:backt=0:centre=0:backt2=0:resetarray (player):resetarray (collisionbas):resetarray (collisionhaut):resetarray (collisiongauche)
resetarray (collisiondroite):resetarray (collisionsousbas):resetarray (testvide):
resetarray (testpf):resetarray (testpl):resetarray (option):
resetarray (displaygain):
cadrechat=0:resetarray (boxchat):barre=0:noir=0:optionlangue=0
endfunction
function deletealltext2()
deletealltext()
resetarray (score):resetarray (textclone):resetarray (nom):resetarray (contenu):
resetarray (players):resetarray (etat):maxpt=0:resetarray (nomperso):
resetarray (textchat):infos=0:gameover=0
retoursalon=0:relancer=0:titretemp=0:titre=0:flvl=0
chatencour=0:load=0:erreurmsg=0:monscore=0
endfunction
for all arrays need to be reset
seem workin
thank again to all