Importing custom classes causes compile error
Mike Oliver <[email protected]> Sat, 25 Apr 2015 15:41:28 -0700 (PDT)
| Newsgroups | gmane.comp.java.robocode |
|---|---|
| Message-ID | <[email protected]> |
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)
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.