Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Class for the Roof Builders
- * By: Alejandro Antorcha
- */
- package Lesson3;
- import kareltherobot.World;
- public class RoofBuilder extends Constructicon {
- public RoofBuilder(int x, int y, Direction d, int b) {
- super(x, y, d, b);
- }
- /**
- * makes the robot appear to turn right
- * @param
- * @return void
- */
- public void turnRight() {
- //changing the delay to 0
- int delay = World.delay();
- World.setDelay(0);
- turnLeft();
- turnLeft();
- //setting the relay to what it was previously set to
- World.setDelay(delay);
- turnLeft();
- }
- /**
- * One movement up a step
- * @param
- * @return void
- */
- public void stepMove() {
- move();
- turnRight();
- move();
- turnLeft();
- }
- /**
- * Builds a roof for the house
- * @param
- * @return void
- */
- public void build() {
- //builds the left of the roof
- for(int i = 0; i < 5; i++) {
- putBeeper();
- stepMove();
- }
- //turns right to orient second part ov the building of the roof
- turnRight();
- //builds the right of the roof
- for(int i = 0; i < 5; i++) {
- putBeeper();
- stepMove();
- }
- //puts the last beeper
- putBeeper();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment