Hey guys,
I really don't know how to make this question easy, but I'll try. If you're looking for a challenge i suggest this :P
I'm making a game so far with 2 characters (in 2 classes); Adeiza and Dooray. Combat and movement are all fine, but now I need to make a ranged special. I've created a MovieClip and a class file for AdzFire, which is basically a fireball created by Adeiza in a certain frame. This fireball is created and moves in the direction I ask it to, which is fine. My problem lies with it hitting the opposing character (currently Dooray). Here are the codes I think are affected;
1. The code in AdzFire.as, called with an enterframe event.
1. The code in frame 1 of the AdzFire movieclip.Code:public function fire(evt:Event) { if (shotDirect==-1) { this.x-=20; } if (shotDirect==1) { this.x+=20; } }
charHolder is where all the characters are added. Sorry bout the unkempt code, didn't know how else to do this part :SCode:for (var n:int=0; n<this.parent.(charHolder as DisplayObjectContainer).numChildren; n++) { if (this.hitTestObject(this.parent.(charHolder as DisplayObjectContainer).getChildAt(n)) && !(this.parent.(charHolder as DisplayObjectContainer).getChildAt(n) is Adeiza)) { this.parent.(charHolder as DisplayObjectContainer).getChildAt(n).takeDamage(this.power); this.parent.removeChild(this); this.removeEventListener(Event.ENTER_FRAME, fire); } else if (this.x<0||this.x>1000) { this.parent.removeChild(this); this.removeEventListener(Event.ENTER_FRAME, fire); } }
The code in my main frame.
Code:function controls(evt:Event):void { //... if(lKey && lReleased){ p1.shoot(); lReleased=false; } //... }
The shoot method in Adeiza.as
and finally my output error. This comes up when the fireball is created :SCode:public function shoot():void { if(!attackLock && sp>=30){ cstate="shoot"; specialTimer.start(); this.gotoAndPlay("shoot"); sp-=30; attackLock=true; } }
Thanks for your help in advance ^^Code:TypeError: Error #1123: Filter operator not supported on type flash.display.MovieClip. at AdzFire/frame1() at flash.display::MovieClip/gotoAndStop() at KnockoutGame_fla::MainTimeline/controls()




Reply With Quote