Monster Racer Rush
Select between 5 monster racers, upgrade your monster skill and win the competition!
4.23 / 5.00 3,881 ViewsBuild and Base
Build most powerful forces, unleash hordes of monster and control your soldiers!
3.93 / 5.00 4,634 Views1.I need to limit my "ammo" variable, so it can't go below zero.
2.How can I put a key code (e.x. key code for M = 77) in a "on(keyPressed)" command?
Please help.
At 7/1/11 03:54 AM, MrMojoRisin5 wrote: 1.I need to limit my "ammo" variable, so it can't go below zero.
2.How can I put a key code (e.x. key code for M = 77) in a "on(keyPressed)" command?
Please help.
Explain what you want to do with the keycode more?
At 7/1/11 03:54 AM, MrMojoRisin5 wrote: 1.I need to limit my "ammo" variable, so it can't go below zero.
2.How can I put a key code (e.x. key code for M = 77) in a "on(keyPressed)" command?
Please help.
You can't limit your ammo variable. Well, actually you can, but limiting the ammo variable will cause problems. What you would want to do is to change the script that decreases ammo to check that your variable is more than 0. For example:
If ammo variable is more than 0
Shoot
else
Don't do anything.
At 7/1/11 03:56 AM, DimebagRip32 wrote:
Explain what you want to do with the keycode more?
I want to disable and enable sound. I have a MC with 2 frames. In frame 1, the sound volume is 100 and in frame 2 it is 0. I 've added one button on each frame with the code:
on(keyPress /*need code here*/ ){
nextFrame();
}
and on the second frame:
on(keyPress /*need code here*/ ){
prevFrame();
}
At 7/1/11 03:57 AM, Secretmapper wrote: You can't limit your ammo variable. Well, actually you can, but limiting the ammo variable will cause problems. What you would want to do is to change the script that decreases ammo to check that your variable is more than 0. For example:
If ammo variable is more than 0
Shoot
else
Don't do anything.
Well, can you explain it more simply to me?
P.S.: I 've added in the "crosshair" MC the code:
onClipEvent(mouseDown){
_root.ammo --;
}
onClipEvent(enterFrame){
if(_root.ammo < 0){
_root.gotoAndPlay("Lost", 1);
}
}
learn actionscript, then ask questions if they are sill there.
At 7/1/11 07:56 AM, Sandremss128 wrote: learn actionscript, then ask questions if they are sill there.
Well, I 'm asking questions so I can learn ActionScript.
can i ask a quick question?
what symbol is used to apply a function to two or more intance names? e.g if want this to apply to the instance named "ground" and to the instance named "block" at the same time.
my Tumblr
My Website
My Soundcloud
Jesus, either it's a bad couple of days or this forum is deteriorating.
Why isn't anyone answering the questions?
At 7/1/11 03:54 AM, MrMojoRisin5 wrote: 1.I need to limit my "ammo" variable, so it can't go below zero.
Just use a simple if statement to check, but I do agree with DimebagRip32.
if(ammo <= 0){
ammo = 0
}
2.How can I put a key code (e.x. key code for M = 77) in a "on(keyPressed)" command?
You don't. You make a keyDown check.
if(Key.isDown(77)){
//Your code hre
}
Of course, since this is just an if statement and not an event listener, you'd need to put this code in an enterFrame event. Whereas, with AS3, you'd just add the keyDown listener and work with that.
At 7/1/11 11:07 AM, terabiter wrote: can i ask a quick question?
what symbol is used to apply a function to two or more intance names? e.g if want this to apply to the instance named "ground" and to the instance named "block" at the same time.
You should make your own thread if you have a question that is irrelevant to the current thread, otherwise that'd be derailing the thread.
As for your question, if you want to apply code to more than one symbol, then just stick all these symbols into an array, loop through that and apply the code. If you're still new to actionscript, look up "arrays" and "for loops".
At 7/1/11 11:27 AM, 4urentertainment wrote: Jesus, either it's a bad couple of days or this forum is deteriorating.
Why isn't anyone answering the questions?
Thank you very much for answering my questions.