Groups | Blog | Home
all groups > flash actionscript > january 2005 >

flash actionscript : 2 MC's



GhettoFabFlah
1/27/2005 9:28:37 PM
The Situation: I am making a game in that whenever you shoot your gun/laser
type thing it has to recharge (symbolized by a bar that stretches from left to
right). both the ammo and the recharging bar are Movie Clips. The Problem:
I can't figure out how to make it so that the ammo only fires when the bars
fully stretched (aka fully recharged). Can anyone help?
mandingo
1/27/2005 10:30:52 PM
there are a couple of ways to do it...

if we take for example that your recharge movieClip is an animated clip with
say 20 frames...

frame 1:
this.recharged = false;

on frame 20:
stop();
this.recharged = true;

when you fire, check the ammoClip.recharged

so something along this line...

firingListener = new Object();
firingListener.onKeyDown = function(){
if(Key.isDown(Key.SPACE)){
if(_root.ammoClip.recharged == true){
_root.ammoClip.gotoAndPlay(1);
launchFiringFunction();
}
}
}
Key.addListener(firingListener);

something along those lines should get you started.
cheers,

Peter Blumenthal
1/28/2005 12:39:47 PM
....and 1 DJ?

:)

AddThis Social Bookmark Button