Animated sprite slow down

Blitz3D Forums/Blitz3D Programming/Animated sprite slow down

Grovesy(Posted 2006) [#1]
Hi all,

I am adding some animated sprites to my game to represent bullets hitting the floor, but it appears to be causing some jerking in the game when either the sprite is created or during the animation.

I create this effect by having one prototype sprite and then every time i want to create a new one I CopyEntity.

This is the technique I am using
;To create the sprite we do a copy
CopiedSprite = CopyEntity( Bullet_Splate_Prototype)

;I then have to update the animation during each game loop
EntityTexture(CopiedSprite , Bullet_Splate_Prototype_Texture, FrameNum)
I am also correctly removing the sprite when the animation has finished.

Any idea why i am getting this jerky slowdown?

Cheers


Ross C(Posted 2006) [#2]
What i would do there, is create a bundle of sprites and put them in a type collection. Then, have a field called ALIVE. Everytime you need a sprite, search the collection for an ALIVE field of 0, set it to 1, unhide and texture it as you wish. It means you aren't creating a freeing sprite all the time, and it will be alot quickier.


Ross C(Posted 2006) [#3]
Also, when you no longer need a sprite, fade it away, hide it and set it's ALIVE field to 0.