Importing Custom Classes
[email protected] Sat, 25 Apr 2015 15:31:55 -0700 (PDT)
| Newsgroups | gmane.comp.java.robocode |
|---|---|
| Message-ID | <[email protected]> |
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)
--
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.