0

我有以下代码。角度函数需要一些来自调用它的类的信息。最好的方法是什么?

class MyScannedRobotEvent extends robocode.ScannedRobotEvent {

    public int angle(robocode.Robot myRobot) {
        return (int) Math.toRadians((myRobot.getHeading() + getBearing()) % 360);
    }
}

public class MyRobot extends robocode.Robot {
int a = MyScannedRobotEvent.angle(*WHATDOIPUTHERE?*);
}
4

1 回答 1

1

通过this

int a = MyScannedRobotEvent.angle(this);

也可以看看:

于 2010-12-24T02:51:49.583 回答