Monster Racer Rush
Select between 5 monster racers, upgrade your monster skill and win the competition!
4.18 / 5.00 3,534 ViewsBuild and Base
Build most powerful forces, unleash hordes of monster and control your soldiers!
3.80 / 5.00 4,200 ViewsSo I have a menu. It's _alpha can be triggered with the space bar function.
onClipEvent(enterFrame){
if(Key.isDown(Key.SPACE)){
_alpha = 100;
}
}
Then I want to make it have a variable so it knows when to trigger it. I did so.
onClipEvent(load){
var active:Boolean = false;
}
onClipEvent(enterFrame){
if(Key.isDown(Key.SPACE) && active == false){
_alpha = 100;
active = true;
}
else if(Key.isDown(Key.SPACE) && active == true){
_alpha = 0;
active = false;
}
}
Presumably, it works. But it glitches. Since it keeps on looping to true and false, it's just plain non-usable.
Is there any way to make it so I can still hold space BUT still have the setting's alpha be 100 and then I press space AGAIN to do that?
Thanks, it would be a great help if you could help me find out what the problem is.
No!
i just started programming a couple weeks go, so this is probably the noobiest fix ever:
onClipEvent(load){
active = false;
space = 1;
}
onClipEvent(enterFrame){
if(Key.isDown(Key.SPACE)&&space==1&&acti ve==false){
_alpha = 100;
active = true;
}
if(!Key.isDown(Key.SPACE)&&active==true)
{
space=2;
}
if(Key.isDown(Key.SPACE)&&space==2&&acti ve==true){
_alpha = 0;
active = false;
}
if(!Key.isDown(Key.SPACE)&&active==false ){
space=1;
}
}
woops, how do you post a code without the forum fking it up? like this?
onClipEvent(load){
active = false;
space = 1;
}
onClipEvent(enterFrame){
if(Key.isDown(Key.SPACE)&&space==1&&active==false){
_alpha = 100;
active = true;
}
if(!Key.isDown(Key.SPACE)&&active==true){
space=2;
}
if(Key.isDown(Key.SPACE)&&space==2&&active==true){
_alpha = 0;
active = false;
}
if(!Key.isDown(Key.SPACE)&&active==false){
space=1;
}
}