Animated Sprite.

Blitz3D Forums/Blitz3D Programming/Animated Sprite.

Paul "Taiphoz"(Posted 2004) [#1]
Iv seen in the past some code, possibly in the archives, that used a quad or sprite and an animstrip to create a 3D animated sprite explosion.

Im wondering if there is any examples of this still floating around. I cant seem to find it or remember where it was I saw it.


aCiD2(Posted 2004) [#2]
Whats the problem with doing that? You need to decide how long the animation should last, and then divide this by the amount of frames. Eg:

animstrip = loadanimtexture("texture", 1, 128, 128, 0, 9)
spr = createsprite()
entitytexture spr, animstrip
time = 9 / 3000   ; animation lasts 3 seconds
currentframe = 0
animtime = millisecs()

while not keyhit(1)
    cls
    if millisecs() > animtime + time
        currentframe = currentframe + 1
        animtime = millisecs()
    endif
    flip
wend


Of course, you would want to make that auto update able, putting it into functions etc. Hope that helps anyway!


Paul "Taiphoz"(Posted 2004) [#3]
erm that didnt work.


Paul "Taiphoz"(Posted 2004) [#4]
got it.


aCiD2(Posted 2004) [#5]
Sorry yavin, i was away from blitz and unable to ttest, good to hear its working now though xD