I am fairly new to robocode and as I was compiling I kept running into errors with the set and get. I was following a tutorial and it worked great in the tutorial however its not working on my PC
public void run() {
setAdjustGunForRobotTurn(true);
setAdjustRadarForGunTurn(true);
turnRadarRightRadians(Double.POSITIVE_INFINITY);
}
public void onScannedRobot(ScannedRobotEvent e) {
double radarTurn = getHeadingRadians() + e.getBearingRadians() - getRadarHeadingRadians();
setTurnRadarRightRadians(Utils.normalRelativeAngle(radarTurn));
}
The errors gotten from the above code is:(Bold letters are where the pointer was pointing)
1: cannot find the symbol t urnRadarRightRadians(Double.POSITIVE_INFINITY);
symbol: method turnRadarRightRadians(double)
2: cannot find symbol double radarTurn = g etHeadingRadians() + e.getBearingRadians() - getRadarHeadingRadians();
symbol: method getHeadingRadians()
3: cannot find symbol double radarTurn = getHeadingRadians() + e.getBearingRadians() - g etRadarHeadingRadians();
symbol: method getRadarHeadingRadians()
4: error: cannot find symbol s etTurnRadarRightRadians(Utils.normalRelativeAngle(radarTurn));
symbol: method setTurnRadarRightRadians(double)
I found the issue was that I was still using the basic robot. My robot(object) was extending robot and the set and get are available only in the AdvancedRobot. Changing it to extend AdvancedRobot and importing robocode.AdvancedRobot; enabled it to work
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.