Hello,
I have created an array to create boxes per x seconds.
I want to delete the boxes with two conditions.
One after the tween ends and another if the circle(player) touches them.
for m = 0 to Boxes.length step 1
If GetSpriteExists(Boxes[m]) = 1
//Tween that reduces alpha color
PlayTweenSprite(BoxTween, Boxes[m], 0)
//Delete after some time
If GetSpriteColorAlpha(Boxes[m]) <= 5
DeleteSprite(Boxes[m])
Boxes.remove(m)
EndIf
//Delete on collision
If GetSpriteCollision(Boxes[m], Circle) = 1
Boxesvar = Boxesvar + 1
PlaySound(BoxesSound, Volume)
DeleteSprite(Boxes[m])
Boxes.remove(m)
EndIf
EndIf
next m
If I touch the Box it works but if I let the box disappear it shows the error Index:0, Array Length: <Empty> in main.agc at line 209.
Line 209 is : If GetSpriteCollision(Boxes[m], Circle) = 1
Can anyone help?