-
Mood Bar. Action Script/Math problem.
I'll try to explain as clearly as possible what I am trying to do here...
I am making a game. I have bars for different needs. (hygene, energy, etc...). There are 6 needs. This works good.
I have another bar that I want to reflect all of those bars as the overall mood bar. I want it so that when the variables for hygene, energy, etc.. change the overall mood bar changes as well. The bar works fine. I need some sort of way to constantly check the 6 mood bars and calculate what the overall mood bar variable would equall.
Does anyone have any idea what I should do?
Frustrated... lol
-
Senior Member
That depends on how your other bars are animated.
Is it some animation that you draw, some ActionScript using an onEnterFrame event or a scripted Tween motion. In the first case you would have to calculate the overall using the same function used to set your variables, in the second case you can use the onEnterFrame event for calculation and in the last case, use onMotionFinished.
Hope it'll help you.
-
Thanks! Can you tell me more about onMotionFinished?
-
Senior Member
Sure, there you go:
PHP Code:
//Given this tween:
var myTween:Tween = new Tween(healthBar, "_x", Strong.easeOut, 0, 70, 50, false);
//Then use onMotionFinished
myTween.onMotionFinished = function() {
calculateOverall(); //This function will be triggered once the tween has reached its final value.
};
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|