USERNAME:
PASSWORD:
Save Info!
Logging in…
This topic is 1 page long.
[ Profile | Posts | Contact ]
Posted at: 6/11/08 09:54 PM
Sign-Up: 04/27/08
Posts: 134
Sorry about this topic, I just am confused about this: I have a boolean above my onClipEvent (enterframe){ it looks like this:
varClose: Boolean onClipEvent (enterframe){ ...
why is there an error????
It is ALWAYS peanut butter jelly time...
Posted at: 6/11/08 10:03 PM
Sign-Up: 02/06/00
Posts: 1,029
If you're placing this action on a movieclip, the variable has to be declared within an onClipEvent function as well, like..
onClipEvent(load) { var whatever:Boolean; }
Or, if the action is being placed on a keyframe, you can't use onClipEvents.
Either way, put a space between var and your variable name if you haven't already.
Posted at: 6/11/08 10:04 PM
hmm, but then the things under it repeat in a cycle...
Posted at: 6/11/08 10:08 PM
AND there are even more errors...
Posted at: 6/11/08 10:10 PM
Sign-Up: 01/03/08
Posts: 283
At 6/11/08 09:54 PM, mariomaster123 wrote: Sorry about this topic, I just am confused about this: I have a boolean above my onClipEvent (enterframe){ it looks like this: varClose: Boolean onClipEvent (enterframe){ ... why is there an error????
you must declare the boolean
var varname:Boolean = true;
Posted at: 6/11/08 10:15 PM
ok, there are still more errors. This is my code, maybe there is something wrong with it:
varClose:Boolean onClipEvent (enterframe) { distance = 200; ux = _root.warrior._x; uy = _root.warrior._y; ex = _root.boss1._x; ey = _root.boss1._y; if (ux-ex<=distance && ux-ex>=-distance) { if abs(warrior._x-enemy1._x)<50){ if (!Close){ attack = random(4); switch (attack) { case 0 : this.gotoAndStop("boss1attack1"); //attack 1 break; case 1 : this.gotoAndStop("boss1attack2"); //attack 2 break; case 2 : //... this.gotoAndStop("boss1attack3"); //attack 3 break; case 3 : this.gotoAndStop("boss1attack4"); //attack 4 break; } Close = true } else Close = false; // Ainarow = attacks in a row } else {
if (ux<ex-40) { this._x -= 2; this.gotoAndStop("boss1walkleft"); //bossisgoingleft!!!! } if (ux>ex+40) { this._x += 2; this.gotoAndStop("boss1walkright"); } } }
Posted at: 6/11/08 10:23 PM
Sign-Up: 03/10/08
Posts: 640
At 6/11/08 10:15 PM, mariomaster123 wrote: ok, there are still more errors. This is my code, maybe there is something wrong with it: varClose:Boolean
Should be on the main timeline, and made like this var Close:Bolean = false or true;
onClipEvent (enterframe) { distance = 200; ux = _root.warrior._x; uy = _root.warrior._y; ex = _root.boss1._x; ey = _root.boss1._y; if (ux-ex<=distance && ux-ex>=-distance) { if abs(warrior._x-enemy1._x)<50){ if (!Close){ attack = random(4); switch (attack) { case 0 : this.gotoAndStop("boss1attack1"); //attack 1 break; case 1 : this.gotoAndStop("boss1attack2"); //attack 2 break; case 2 : //... this.gotoAndStop("boss1attack3"); //attack 3 break; case 3 : this.gotoAndStop("boss1attack4"); //attack 4 break; } Close = true
Should be Close == true; (= is for setting a value, == is declaring it or whateever)
} else Close = false;
else Close == false;
// Ainarow = attacks in a row } else { if (ux<ex-40) { this._x -= 2; this.gotoAndStop("boss1walkleft"); //bossisgoingleft!!!! } if (ux>ex+40) { this._x += 2; this.gotoAndStop("boss1walkright"); } } }
Try all that stuff, theres prob more
Footsteps of zrb || As:Main || As3:Main || Flash Tutorials || PM me for help. ||
Posted at: 6/11/08 10:24 PM
Sign-Up: 08/08/06
Posts: 3,851
varClose:Boolean onClipEvent (enterframe) {
Your off on a bad start. Anyways here's the revised version of your code, no errors too:
onClipEvent (enterFrame) { var Close:Boolean; distance = 200; ux = _root.warrior._x; uy = _root.warrior._y; ex = _root.boss1._x; ey = _root.boss1._y; if (ux-ex<=distance && ux-ex>=-distance) { if (abs(warrior._x-enemy1._x)<50) { if (!Close) { attack = random(4); switch (attack) { case 0 : this.gotoAndStop("boss1attack1"); //attack 1 break; case 1 : this.gotoAndStop("boss1attack2"); //attack 2 break; case 2 : //... this.gotoAndStop("boss1attack3"); //attack 3 break; case 3 : this.gotoAndStop("boss1attack4"); //attack 4 break; } Close = true; } else { Close = false; }// Ainarow = attacks in a row } else { if (ux<ex-40) { this._x -= 2; this.gotoAndStop("boss1walkleft"); //bossisgoingleft!!!! } if (ux>ex+40) { this._x += 2; this.gotoAndStop("boss1walkright"); } } } }
I can speak french :3 || As :Main || As3: Main || Animation: Main || Flash Tutorials ||
Posted at: 6/11/08 10:26 PM
love ya ZRB, ur ausome lol
Posted at: 6/11/08 10:29 PM
lol, ur stuff only makes him what he did before Essentially, I want him to do one of the four attacks at the certain distance... he is now walking at the certain distance
Posted at: 6/11/08 10:33 PM
Well I didn't really know that since you didn't mention it. I thought all you needed was help with all your errors. Try to figure it out now that there are no errors.
Posted at: 6/11/08 10:40 PM
ok, well i completly confused now errors are a problem, but making my enemy do what he has to do is WAY more important, that is the whole goal...
Posted at: 6/12/08 10:16 PM
i think the boolean HAS to be in front for the guy to DO his attack and then reset the flag...
All times are Eastern Daylight Time (GMT -4) | Current Time: 07:34 PM
<< Back