COSC 3P91

Assignment 3

Instructor: Michael Winter, Office J323, email: mwinter@brocku.ca


RoboRace (Part 3)

In this assignment you are going to implement the animated GUI for RoboRace.

The animated BoardCanvas

The upper part of the JFrame (i.e., the class Player) should be occupied by a threaded Canvas. The thread is responsible to execute the animation loop described in class using page flipping. Use the methods start, update, draw of the Board class for staring, updating, and drawing the board.

Implement the update and draw in the class Factory. These methods are called from the corresponding methods in the class Board

The class Robot has a number of animations which can be selected using the method setCurrentAnimation. These animations should be started in the methods turn, halfturn, and move of this class. If the robot moves on the board (or turns), the image should slowly move (or turn) to this new location. Once the animation is completed any thread waiting in waitForRobot has to be notified. Implement those methods accordingly.

The class CardPane

The lower part of the JFrame is occupied by a CardPane, a subclass of JPanel. Here you should rely on the AWT thread for painting and handling mouse events, i.e. implement paintComponent, call repaint, and implement listeners.

Sources

  1. You find a project folder to start here.

COSC Home Page
COSC 3P91 Home Page
© M. Winter, 2017