-
Stats bars
Hey guys,
I'm currently working on a sniper rifle game, well the menu and stats screen at the moment and have 4 stats bars for each rifle (range, recoil, mag size and mobility) will be 5 soon when added rate of fire. Each rifle has different stats and the range bar (for example) will be different widths for each rifle. If I wanted the scope add on 100 pixels of width to the range bar no matter what size it currently is how do I go about it?
-
When you know are.
Use the Games forum's search to find an answer. Search for "stat bar", "life bar", "power bar", etc. Discusssed many many many times already.
-
Already had a look but didn't see what code I'm looking for. Searching on my mobile as just moved house and sky have quoted me a month to get broadband back up.
-
Already had a look but didn't see what code I'm looking for. Searching on my mobile as just moved house and sky have quoted me a month to get broadband back up.
-
When you know are.
I don't really understand your question, maybe a picture would help. I'll try to explain.
Think of the concept as basic algebra. You have your current stat and your maximum stat. Just make that into a percentage.
Actionscript Code:
var perc:Number = (currentStat/maximumStat);
Then you can multiply that percentage with the width or use that percentage to choose a frame.
Actionscript Code:
var barMaxWidth:Number = 300;
bar1.width = barMaxWidth * perc
or
Actionscript Code:
bar1.gotoAndStop( bar1.totalFrames * perc);
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
|