private void makePrettyThings() { // 1. Create a new Robot Robot bolbi = new Robot(); // 3. Put the robot's pen down bolbi.penDown(); // 8. Make the robot go at maximum speed (10) bolbi.setSpeed(10); // 9. Set the pen to a color that you like for the shape bolbi.setPenColor(0, 200, 255); // 4. Make a variable for the number of sides you want (can’t test this one) int mySides = 55; // 5. Make a variable for the angle you want the robot to turn. Hint: you can divide in Java // using "/". Can’t test until step 6. int angle = 360 / 55; // 7. Do steps #2 to #11, 200 times. When this is done you should see a pentagon. for (int i = 0; i < 200; i++) { bolbi.setRandomPenColor(); // 2. Move the robot 200 pixels bolbi.move(15); // 10. Make the robot move "i" pixels instead of 200 (don’t need new line of code for this, // just change previous one) // 6. Turn the robot the amount in your angle variable bolbi.turn(angle); // 11. Turn the robot one more degree } }
public static void main(String[] args) { Robot Maria = new Robot("batman"); Maria.setWindowColor(Color.RED.darker()); Maria.setPenColor(Color.white); Maria.penDown(); Maria.sparkle(); for (int i = 0; i < 4; i++) { Maria.move(50); Maria.turn(90); } }
public static void main(String[] args) { Robot the = new Robot(); the.penDown(); the.setSpeed(300); the.setPenWidth(50); the.setPenColor(Color.PINK); for (int i = 0; i < 4; i++) { the.move(101); the.turn(630); } }