Hey Flemming,
I selected the robot one in the source editor. I did compile it, but it
still doesn't show up when I want to select robots for a battle.
This is my code. It's fairly simple, I just wanted to see if the robot
worked.
package irtatters;
import robocode.*;
//import java.awt.Color;
// API help :
http://robocode.sourceforge.net/docs/robocode/robocode/Robot.html
/**
* Hey - a robot by (your name here)
*/
public class Hey extends Robot
{
/**
* run: Hey's default behavior
*/
}
public void run() {
// Initialization of the robot should be put here
// After trying out your robot, try uncommenting the import at the top,
// and the next line:
// setColors(Color.red,Color.blue,Color.green); // body,gun,radar
// Robot main loop
while(true) {
// Replace the next 4 lines with any behavior you would like
ahead(100);
turnRight(45);
}
}
/**
* onScannedRobot: What to do when you see another robot
*/
public void onScannedRobot(ScannedRobotEvent e) {
// Replace the next line with any behavior you would like
if (e.getEnergy() > 25) {
fire(3);
} else if (e.getEnergy() > 10) {
fire(1);
}
}
/**
* onHitWall: What to do when you hit a wall
*/
public void onHitWall(HitWallEvent e) {
// Replace the next line with any behavior you would like
back(30);
}
}
Post by fnlHi Ian,
I am not sure I understand, what you try to do. Regarding templates,
- newjavafile.tpt
- newjuniorrobot.tpt
- newrobot.tpt
These are used for the Source Editor, when creating a new Java file,
JuniorRobot, or Robot. Of course, you are free to modify those templates,
if you want to.
A template will just flesh out a Robot class. Hence, when you compile
your robot class, it should show up when selecting robots for a new battle.
You could send me your template to fnl (at) users.sourceforge.net, so I
can check if something is not right.
Cheers,
- Flemming
Post by i***@gmail.comSo I made some tweaks to the template to see how the robot would behave.
Unfortunately I can't find it to select for a battle. It's in the robot map
in the map irtatters (that's what I called the package). Now if I want to
start a new battle I see all the packages like sample, team, ect. but not
irtatters. I tried control r and clean robot cache. Can someone help me?
--
You received this message because you are subscribed to a topic in the
Google Groups "robocode" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/robocode/PPPqVcb6Mvs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
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.