-
Help with Health Bar
Hello i'm new to this site and is seeing if anyone could help me with this problem..
I am making a platformer which you use the arrow keys to move. My problem is the health bar, it works perfectly fine but, when the bar reaches zero i can't make it go to a game over frame.... Here is all of the code:
Health Bar: (Instance name: HP)
onClipEvent(enterFrame){
this._xscale = _root.hp;
if(_root.hp < 0){
_root.hp = 0;
}
}
Frame:
Stop()
_root.hp = 100;
If someone could help me with this i would really appreciate it. (I have been stuck on this for a couple months now)
-
what about simple gotoAndStop(gameOverFrame); ?
You may want to use function onEnterFrame() {
game code here
}
on a frame on the main timeline instead on a movie clip. Possibly wrap everything within if (gameover == 0) { } ( inside that onEnterFrame function )
then when helath bar reaches 0, set gameover = 1, and do gotoAndStop( gameOverFrame); and don't forget to set variable gameover = 0; before onEnterFrame function.
-
Gj Mikemd :P you stole my response no hero points for me