Difference between revisions of "Robocode/Eclipse/Create a Robot"

From Robowiki
Jump to navigation Jump to search
m
m (Backup changes)
Line 4: Line 4:
  
 
== Creating a Robot in Eclipse ==
 
== Creating a Robot in Eclipse ==
 +
Ok, so we have a project now, and it's time to create a robot (or many robots!) in it.
 +
 +
First, right-click on the '''MyRobots''' project, and select New -> Class:
 +
 +
http://robocode.sourceforge.net/help/ide/newclass.png
 +
 +
Next, fill in the package name (Robocode suggests your initials), a Robot Name (here I have '''FnlBot'''), and change the '''Superclass''' field to '''robocode.Robot''':
 +
 +
http://robocode.sourceforge.net/help/ide/newclassdialog.png
 +
 +
Click '''Finish''', and you'll see your robot class, like this:
 +
 +
http://robocode.sourceforge.net/help/ide/edit1.png
 +
 +
You can now edit your robot however you like.
 +
 +
 +
 +
You can save your robot as often as you like by hitting CTRL-S, or selecting "File->Save". There's no need to select Compile anymore, since Eclipse takes care of it for you. Have fun playing around with Eclipse. Personally, I like to change all the colors, turn off bold print, move the windows around, and do all sort of things to customize it to my liking. Since there's no better way to learn than by playing around, I'll leave you to it! (Hint: Workbench -> Preferences -> Java -> Editor -> Colors)
 +
 +
The only thing left is to make sure Robocode sees your robot.
 +
  
 
== See Also ==
 
== See Also ==
  
 
[[Category:Robocode Documentation]]
 
[[Category:Robocode Documentation]]

Revision as of 21:39, 28 November 2007

This article is a stub. You can help RoboWiki by expanding it.

This page describes how to create a robot in Eclipse, and assume that you already now how to create a project in Eclipse.

Creating a Robot in Eclipse

Ok, so we have a project now, and it's time to create a robot (or many robots!) in it.

First, right-click on the MyRobots project, and select New -> Class:

http://robocode.sourceforge.net/help/ide/newclass.png

Next, fill in the package name (Robocode suggests your initials), a Robot Name (here I have FnlBot), and change the Superclass field to robocode.Robot:

http://robocode.sourceforge.net/help/ide/newclassdialog.png

Click Finish, and you'll see your robot class, like this:

http://robocode.sourceforge.net/help/ide/edit1.png

You can now edit your robot however you like.


You can save your robot as often as you like by hitting CTRL-S, or selecting "File->Save". There's no need to select Compile anymore, since Eclipse takes care of it for you. Have fun playing around with Eclipse. Personally, I like to change all the colors, turn off bold print, move the windows around, and do all sort of things to customize it to my liking. Since there's no better way to learn than by playing around, I'll leave you to it! (Hint: Workbench -> Preferences -> Java -> Editor -> Colors)

The only thing left is to make sure Robocode sees your robot.


See Also