Topic: Health Bar (script)

Finally got this Health Bar script finished and neat:

box = getObject("box")
ground = getObject("ground")
bar = getObject("bar")

lastFrame=60
firstFrame=3

function onSceneUpdate()
    setCurrentFrame(bar,lastFrame)
   
    if isCollisionBetween(box,ground) then
        lastFrame = lastFrame - 1
    end
   
    if lastFrame <= firstFrame then
        lastFrame = firstFrame
    end
end


Wondering, however, how I would get the setAnimationSpeed() function to work with this. I can't quite place it. I could use a little help.

Last edited by Tutorial Doctor (2013-08-20 00:54:23)

Re: Health Bar (script)

setAnimationSpeed controls at what speed the animation is played,
so if you use setCurrentFrame to manually set the frame of the animation
the animation speed is useless (you don't want the animation to be played as you control it yourself).

Re: Health Bar (script)

anael wrote:

setAnimationSpeed controls at what speed the animation is played,
so if you use setCurrentFrame to manually set the frame of the animation
the animation speed is useless (you don't want the animation to be played as you control it yourself).

ahh!! hehe

I initially had trouble also because I tried to use a while loop in the update function instead of an if conditional statement (forgot the update function automatically loops the if function in a way). doh! hehe

Thank you anael. I wish these forums were more alive. It seems you are the main person who responds to things. And while that is good, I know it can be a lot for one person.

I just found out how to get my sketchup models into blender intact and into Maratis. Now I have to get the light-mapping down for Blender, and I can set up a few more Demo levels so that people can see the possibilities of Maratis. 

Thanks again.