0

这部分编码用于塔防游戏中的炮塔。截至目前,它没有出现,如果有人看到错误帮助将不胜感激。

    package 
    {
        import flash.display.MovieClip;
        import flash.events.*;
        public class Turret extends MovieClip
        {
            private var _root:MovieClip;

            public function Turret()
            {
                this.addEventListener(Event.ADDED, beginClass);
                this.addEventListener(Event.ENTER_FRAME, eFrameEvents);
            }
            private function beginClass(e:Event):void
**//Where I make the turret itself**            
{
                _root = MovieClip(root);
                this.graphics.beginFill(0xFFD700);
                this.graphics.drawCircle(0,0,12.5);
                this.graphics.endFill();
                this.graphics.beginFill(0xFFD700);
                this.graphics.drawRect(-2.5, 0, 5, 20);
                this.graphics.endFill();
            }
            private function eFrameEvents(e:Event):void
            {

                if (_root.gameOver)
                {
                    this.removeEventListener(Event.ENTER_FRAME, eFrameEvents);
                    MovieClip(this.parent).removeChild(this);
                }
            }
        }
    }
4

1 回答 1

0

在函数之前放置注释的地方存在语法错误。去掉前面的星号...

...
private function beginClass(e:Event):void
//Where I make the turret itself            
{
    _root = MovieClip(root);
    ...
于 2012-12-20T19:31:45.410 回答