473,471 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Health bar percentage rise help needed

11 New Member
Ok, for the game that I am creating at the moment I have a health bar animation that starts off full and empties as time goes on. When the health bar is empty it goes to the gameover screen. This part works fine.

What I would like to happen is when the user runs into a target for the bar to increase by 10%, giving the user more time. The way it is set up at the moment the healthbar movieclip has the instance name "healthbar".

Inside this are 100 frames showing the bar going down (shape tween broken down into keyframes). 1 is the full healthbar, 0 is the empty healthbar.

On the target I have the following code:

//10 is the number of frames I would like to increase the bar by
_root.healthbar += 10;

However the bar just seems to keep going down. I think I need to find out the current frame the bar is at before adding 10 pixels to it but dont know how. Any help, can provide the .Fla if needed.

Thanks,

Martin
Sep 18 '07 #1
1 3454
bergy
89 New Member
If you're using _root.healthbar += 10 exactly as you have typed that is your problem. "_root.healthbar" represents a MovieClip, so adding the Number 10 to the MovieClip isn't going to do anything.

Try This:
Expand|Select|Wrap|Line Numbers
  1. _root.healthbar.gotoAndPlay(_root.healthbar._currentframe + 10);
  2.  
The above would be for ActionScript 2 (I'm assuming because of the depreciated _root keyword that's what you're coding in) - if you're using AS3 the equivalent is something like .currentFrame - I think.

Edit: bleh for some reason in the code listing it's putting curre ntframe - with spaces in _currentframe. Make sure that's all one word if you copy and paste it.
Sep 22 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: SK | last post by:
How to achieve this*? Percentage number is always in the middle of the table. If needed, the number is overlayed over the cell border (for example, in case of "55%"). Thanks, ...
7
by: Bruce MacDonald | last post by:
I am unable to see the health monitor SQL table functions (e.g.: SQLPROC.HEALTH_CONT_HI). Have I missed a utility which registers the functions? DB2 8.1.3.132 WR21324. Another point about the...
2
by: Debbie E | last post by:
Are there any issues with the Health Monitor in a partitioned environment? I have turned on the health monitor and can obtain the health snapshot for the DBM via the following command: get...
3
by: nycjay | last post by:
hello, i am just getting started as a dba. ny current task is to set up notification for health alerts. so, we have the health monitor running, and it is currently putting health alerts (space...
0
by: nycjay | last post by:
i am trying to use the db2 health monitor alert to run a script. i set up the health monitor to run a script when the tablespace utailization is too high. in the end, the script should send a...
1
by: Bigeloww | last post by:
Dollar is going to rise! Good news for US http://my.usatodays.us/money/myusatoday.html ---------------------------------- http://community.ihostasp.net ASP.NET Developer Community
4
by: Maddy | last post by:
Hi all, I am new to DB2 database.I just have the basic knowledge abt this database.I in a serious situation of handling 5 large databases.Can some one help me how to prepare the health check...
4
by: Klauer | last post by:
Hello All! I have been thinking about this quite a bit recently, and was wondering if my stereotypes are founded on truth or just stereotypical assumptions about programmers and health. It's...
5
by: jbenner | last post by:
I have opened a PMR for this with IBM, and am not asking for advice from the DB2 DBA community. I am posting this as an FYI that DB2 Health Monitor, even at the latest version of DB2, still can cause...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.