Hi there
I’m working on a game. The tank, which the player controls, has the ability to cloak itself. To represent this, I change the _alpha of the movieclip of the tank. I want the tank become invisible (i.e. _alpha = 20, can’t _alpha = 0 as the player must be able to see it. This is only a visual effect) whenever the player press “s” (with keycode 83).
The tank must uncloak itself to fire high power weapons. So the player can uncloak it by pressing “s” again. Then here comes the problem… How can I do that?
Like this?
onClipEvent (load ) {
var cloaked:Boolean = true
}
onClipEvent (enterFrame) {
if ((Key.isDown (83)) && (!cloaked)) {
this._alpha = 20
} else if ((Key.isDown (83)) && (cloaked)) {
this._alpha = 100
}
}
Actually, I’m not too sure how to use Booleans…