Mike Oliver
2015-04-25 22:41:28 UTC
I'm going to try and repost this. For some reason my original topic
disappeared.
I am trying to clean up my robot code and make it more reusable by creating
custom classes. Unfortunately I cant figure out how to access the
functions once they are imported. I get compile errors.
Robowiki and repository I'm sure would allow me to figure this out, but
since they are both down, I have limited solutions. Apologies for such a
newb question but any help would be appreciated.
Mike
myUtils.java (compiles)
package mo;
import robocode.*;
public class myUtils extends AdvancedRobot{
public void spin() {
setTurnRight(10000);
}
}
myBot2.java (doesnt compile)
package mo;
import robocode.*;
import mo.myUtils;
public class myBot2 {
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)
disappeared.
I am trying to clean up my robot code and make it more reusable by creating
custom classes. Unfortunately I cant figure out how to access the
functions once they are imported. I get compile errors.
Robowiki and repository I'm sure would allow me to figure this out, but
since they are both down, I have limited solutions. Apologies for such a
newb question but any help would be appreciated.
Mike
myUtils.java (compiles)
package mo;
import robocode.*;
public class myUtils extends AdvancedRobot{
public void spin() {
setTurnRight(10000);
}
}
myBot2.java (doesnt compile)
package mo;
import robocode.*;
import mo.myUtils;
public class myBot2 {
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.