0

我正在尝试从我的 40×40 像素飞船上找出在哪里产生子弹,此时飞船朝北,机头距离中心 20 像素,所以这是我的代码尝试解决

if( rotate < 0 )
        {
            actRotate = 360 - (rotate * -1) ;
            trace(actRotate);
        }
        else
        {
            actRotate = rotate;
        }
        //var rotateTemp:Number = this.rotation * (180 / Math.PI);
        //this.x = xPos;
        //this.y = yPos;
        _speed_x = Math.sin(rotation*0.0174532925)*7.5;
        _speed_y =- Math.cos(rotation*0.0174532925)*7.5;

        var noseX:Number = xPos + (NoseOfShip * Math.cos(actRotate));
        var noseY:Number = yPos + (NoseOfShip * Math.sin(actRotate));

        this.x = noseX;
        this.y = noseY;

好的,让我简单介绍一下,如果我将船向右旋转 90 它将给出 90 作为值,如果我将船旋转 180 度,则旋转的值为 -180,如果我将船逆时针旋转 90它是-90。现在我真的很困惑为什么 Flash CS6 会这样做:(,所以我尝试在上面创建一个转换器,如您所见,如果旋转是负数,那么只需找出它是什么。现在这段代码只有在船是-90(270)度。如果船是0,90,-180(180),子弹从鼻子向左打20像素。如果有人可以帮我一把,那将非常有帮助,另外,如果您需要更多信息,请在此处发布

谢谢你。

4

0 回答 0