o***@gmail.com
2015-04-25 22:31:55 UTC
This may be a silly beginner question, but how do I access functions after
importing a custom class? When I compile I receive 'undefined method'
errors. Ideally I would like to clean up my code and make it more reusable.
Robowiki and repository are down, so my options to learn are pretty limited.
myUtils.java (compiles)
package mo;
import robocode.*;
public class myUtils extends AdvancedRobot{
public void spin() {
setTurnRight(10000);
}
}
myBot.java (doesnt compile)
package mo;
import robocode.*;
import mo.myUtils;
import java.awt.Color;
public class myBot {
public void run() {
while(true) {
spin();
}
}
}
Compile Error:
Compiling...
----------
1. ERROR in D:\MyFiles\Games\RoboCode\robots\mo\MyBot2.java (at line 11)
spin();
^^^^
The method spin() is undefined for the type MyBot2
----------
1 problem (1 error)
Compile Failed (-1)
importing a custom class? When I compile I receive 'undefined method'
errors. Ideally I would like to clean up my code and make it more reusable.
Robowiki and repository are down, so my options to learn are pretty limited.
myUtils.java (compiles)
package mo;
import robocode.*;
public class myUtils extends AdvancedRobot{
public void spin() {
setTurnRight(10000);
}
}
myBot.java (doesnt compile)
package mo;
import robocode.*;
import mo.myUtils;
import java.awt.Color;
public class myBot {
public void run() {
while(true) {
spin();
}
}
}
Compile Error:
Compiling...
----------
1. ERROR in D:\MyFiles\Games\RoboCode\robots\mo\MyBot2.java (at line 11)
spin();
^^^^
The method spin() is undefined for the type MyBot2
----------
1 problem (1 error)
Compile Failed (-1)
--
You received this message because you are subscribed to the Google Groups "robocode" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robocode+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "robocode" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robocode+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.