logo CodeStepByStep logo

InteractiveKarel

Write a complete program named InteractiveKarel with a graphical user interface that imitates some aspects of how Karel the Robot behaves. As shown in the diagram to the right, you should create a move button and a turnLeft button. Pressing move causes Karel to move one length in the direction it is facing, and pressing turnLeft causes Karel to turn left. If moving Karel would cause it to move off the screen, just keep Karel where it is. You can assume you are given four images for each of the directions that Karel can face called KarelEast.jpg, KarelWest.jpg, KarelSouth.jpg, and KarelNorth.jpg. You can each of these images are 64 pixels in width and height. Note: It may simplify your code to know that GraphicsPrograms come with pre-existing String constants named NORTH, SOUTH, EAST, and WEST whose values are "North", "South", etc.

screenshot

This exercise does not have any test cases associated with it. You can look at this exercise and try to write your own solution on your computer in a text editor, but you cannot submit it here for testing. We're sorry for the inconvenience.

Need help?

If you do not understand how to solve an exercise or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect tests, etc.), please

Is there a problem? Contact a site administrator.

©, all rights reserved.