Making a object appear and dissapear
okay know way off attemp. when press space want 'sword' appear , when not dont want there.
sorry if not 1% on right track, clue im talking about? cheers.
var weopon_var:boolean = false;
if (key.isdown(key.space)){
weopon_var = true;
else {
weopon_var = false;
}
if (weopon_var = true){
gotoandplay("sword_on")
} else {
(weopon_var = false){
gotoandplay("sword_off"
}
}
there errors in code need fix before can anywhere it... if/else structuring/syntax wrong. examples offor correct way structure them.
when compare values in conditional equality use "==" not "=". "=" assigning value something.
further, if testing boolean (true/false), don't need test explicitly. conditional evaluating true/false nature of put in parenthesis. , if testing boolean, if isn't 1 has other. reduce second test be...
if(weopon_var){
// stuff
} else {
// other stuff
}
whether work when errors out depends on have code. if code sits shown, executes once when enter frame once. need have listener keyboard event tied code when use keyboard function code in gets executed. "key.addlistener"
More discussions in ActionScript 1 and 2
adobe
Comments
Post a Comment