Zuljaras
Member
Hello!
So I have this problem that I create a lightning effect and after its animation is done I destroy it. However the instance is NOT destroyed if I have odd number of sprite images.
Here is the code:
And this is the code of the instances:
Create event:
Animation End event:
logo_lightning_sparks_spr2 - has 9 images
logo_lightning_sparks_spr - has 10 images
Instances with logo_lightning_sparks_spr2 are not destroyed on animation end.
The game is running at 60 FPS.
There has to be some explanation. Especially when you consider that it is working flawlessly on GMS1.4. I thought that Animation end event is executing ALWAYS when the Sprite animation ends. The ODD numbered sprites loop like crazy and the instance do not destroy itself.
Any ideas?
So I have this problem that I create a lightning effect and after its animation is done I destroy it. However the instance is NOT destroyed if I have odd number of sprite images.
Here is the code:
GML:
spark1 = instance_create(self.x+20,self.y+25,logo_lightning_obj);
spark1.sprite_index=logo_lightning_sparks_spr;
spark1.image_speed=choose(0.2,0.3,0.4);
spark2 = instance_create(self.x+200,self.y+34,logo_lightning_obj);
spark2.sprite_index=logo_lightning_sparks_spr2;
spark2.image_speed=choose(0.2,0.3,0.4);
spark3 = instance_create(self.x+choose(140,170,200),self.y+choose(25,34,45),logo_lightning_obj);
spark3.sprite_index=logo_lightning_sparks_spr;
spark3.image_speed=choose(0.2,0.3,0.4);
spark4 = instance_create(self.x+choose(100,130,200),self.y+choose(25,34),logo_lightning_obj);
spark4.sprite_index=logo_lightning_sparks_spr2;
spark4.image_speed=choose(0.2,0.3,0.4);
spark5 = instance_create(self.x+choose(50,90,130),self.y+45,logo_lightning_obj);
spark5.sprite_index=logo_lightning_sparks_spr;
spark5.image_speed=choose(0.2,0.3,0.4);
Create event:
Code:
image_index = 0;
Code:
instance_destroy();
logo_lightning_sparks_spr2 - has 9 images
logo_lightning_sparks_spr - has 10 images
Instances with logo_lightning_sparks_spr2 are not destroyed on animation end.
The game is running at 60 FPS.
There has to be some explanation. Especially when you consider that it is working flawlessly on GMS1.4. I thought that Animation end event is executing ALWAYS when the Sprite animation ends. The ODD numbered sprites loop like crazy and the instance do not destroy itself.
Any ideas?