-
[F8] Health bar help
Ok. In my game, I have a bunch of randomly generated circles that fall and blow up when they hit a platform.
I have that part down, but i wanted the circles to damage the platform so that every time a circle would fall on the platform it would bring the platform's health down.
thanks and sorry if this is a stupid question.
-
Are these circles , removed when they hit the platform ?? Have you done this part ??
-
yes, when they hit the platform the circles start playing the explosion part of thier timeline (which makes it look like the circles are exploding as they hit the platform) and then the MC is removed
-
( Plz , first tell me where hitTest code is placed in frame or MC ...?? )
Ok ... lets start. This code put on frame :
onLoad = function(){
var PlatformHealth:Number = 100;
}
And this code put where your hitTest function is :
PlatformHealth -= 5;
And if you want the health to show in textBox , create dynamic textBox and name it Health ... And put this code on frame:
_root.Health.text = PlatformHealth;
And at last if you want to make health bar , as you write in title , do this :
Create an MovieClip and inside it draw the health bar you want ... Give the instance name HealthBar ... And use this code :
_root.HealthBar._xscale = PlatformHealth;
If you will have any problem , any question is welcomed
I hope this all will help you
.PumI.
Last edited by pumi; 06-06-2007 at 06:18 PM.
-
thanks so much ill try it
-
can you tell me where the hitTest is placed ... on MC or on frame ??
-
hmm.. in the dynamic text box it just says undefined
-
Where is the hitTest function PLACED ????????
-
the hittest is in the circle movieclip's timeline, on the second frame
-
can you post the file ... PLZ ??
-
sorry but its too big, and its still to big when i try to compress it
-
try this code i gave to you
onLoad = function(){
var PlatformHealth:Number = 100;
}
change to
var PlatformHealth:Number = 100;
-
and on hitTest function instead of:
PlatformHealth -= 5;
try
_root.PlatformHealth -= 5;
-
its still not working......and sorry for all this confusion
-
Your TextBox and :
var PlatformHealth:Number = 100;
And :
onEnterFrame = function(){
_root.Health.text = PlatformHealth;
}
are in main timeline and this :
_root.PlatformHealth -= 5;
is inside hitTest function , Right ??
If it wont work ... try emailing the file to me , or uploading it here :
http://www.creativededication.com
using thir free hosting service ...
-
let me get your E-Mail address and ill email it to you, because your email address is blocked when i click on your profile
send me a private message if you dont wantpeople to see you address
-
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
|