-
Hi,
I want to add a simple power bar to one of my games. I want it to scroll up and down quickly and stop somewhere between 0-100% when the player presses a button or clicks the mouse. It needs to work on a relatively slow frame rate - ie. 15fps.
I tried drawing a rectangle and using a " onClipEvent (enterFrame)... _xscale++ " type script, but this makes the rectabgle scroll up and down much too slowly.
Can anyone briefly outline a better way of doing it ???
Thanks in advance ...
Ben
-
Make a 100 px bar, and put this code in it:
Make sure the bar is aligned to the left of the little circle marking the middle of the MC
Code:
onClipEvent (load) {
speed = 10;
}
onClipEvent (enterFrame) {
if (_xscale+speed>100 || _xscale+speed<0) {
speed *= -1;
}
_xscale += speed;
}
onClipEvent (mouseDown) {
// Do whatever. Power = _xscale;
}