yhack
August 2, 2004, 8:03pm
1
Hi i have a bar of 6 bullets
1 2 3 4 5 6
when there all gone it ses reload
ive got all the frames worked out and everything but i need help with actionscript…
I thought when u click (shoot) on a enemy it cud set a variable -1.
when its at 6 “_root.bullets” frame is 7, when at 5 frame it 6 etc.
then when u press space it sets the variable to 6 which would make the frame 7
if you could help me with any or all of this i would be grateful
thx in advance,
yhack
system
August 3, 2004, 12:05am
2
okay, assuming you have 7 frames in MC with an instance of bullets…
where the 7th frame has 6 bullets,
6th frames has 5 bullets,
5th frame has 4 bullets,
4th frame has 3 bullets, 3rd frame has 2 bullets,
2nd frame has one bullet
and the first frame says reload…
put this AS on the main timeLine first keyframe:
numBullets = 6;
bullets.gotoAndStop(7);
this.onMouseDown = function() {
if (numBullets>=1) {
numBullets -= 1;
bullets.gotoAndStop(numBullets+1);
}
};
Key.addListener(this);
this.onKeyDown = function() {
if(key.isDown(key.SPACE)) {
numBullets = 6;
bullets.gotoAndStop(7);
}
};
That will do it…