CSE 115/503 - Spring 2011 - Banner
• CSE 115/503 - Spring 2011
CSE 115/503 - Spring 2011 - Navigation
CSE 115/503 - Spring 2011 - Lab 7

CSE 115/503 - Spring 2011 - Lab 7

### Introduction

It is the time of year again when we ask all the 115 students to build something fun, something exciting, something they will treasure forever (the last assignment of 115!) Seriously, just ask Dan, Drew, Sarah, and Julie what their last assignments were and they can tell you...

This year, in honor of a fairly old (and arguably cult-classic) movie (which spawned a classic arcade game), which recently had an update and "sequel", we will recreate a piece of the arcade game.

The game we will be creating is Tron Light Cycles. If you are not familiar with it, feel free to search for an online version to play (or play this one).

### Assignment Specifications

This assignment will be completed in Labs 7 & 8. There are certain parts we would like you to finish in Lab 7 and others in Lab 8. It is important that you do not move on to implementing different features of the game than assigned in the assignment.

There is a skeleton available for the lab, please check it out before beginning your work.

#### Game appears

Your first task should be to determine how you would like your game to look AFTER reading all of the steps in the assignment so far. Then, figure out what graphical components you need to complete your vision.

First, make sure that when the game starts, the first light cycle appears on the screen.

#### Change direction of Light Cycle

Make the light cycle that is on the screen react to key presses. That is, determine a key for each of the directions (up, down, left, right) and when the user presses those keys, the light cycle should turn to that direction. Note that at this point, you need to consider the fact that the light cycle needs to keep track of which direction it is facing. You may want to look at the example named MovingChosenGraphicWithButtonsUsingEnum in the LectureCode repository for a way to keep track of the direction of movement internal to a shape. There are a number of different ways to implement the idea that the light cycle retains the information about its direction.

Create a button for your game that will reset the game back to its original configuration. It is probably best to create a method named reset that will actually take care of resetting the game. You will need to add to this method as you add functionality to the game. But for now, you should make sure that if you change the direction of the light cycle, hitting the reset button puts the light cycle back to its original configuration.

Create a second light cycle for the game that is different in color from the first. The second light cycle should turn up, down, left, and right to a different set of keys than the first light cycle. After you add the second light cycle, the reset button should reset them both.

#### Key to move light cycles

Create a key listener for a key that when pressed will move the light cycle in the currently facing direction. This is not how the game will eventually be played, but during this phase of the development and testing, connect the movement of the light cycle to a key. The light cycle should move and change directions and then move accordingly. Now, reset should put the light cycles back to their original positions and orientations on the board.

### Due dates

You will submit your Lab 7 assignment using the Web-CAT submission plugin from Eclipse. There will be no automatic grading for this assignment. You will receive a score of zero when you submit and then it will be updated when the TA is finished grading your submission.

Recitation Due Date
A1 Monday, April 18th at 9:00pm
A2 & A5 Tuesday, April 19th at 9:00pm
A3 & A6 Wednesday, April 20th at 9:00pm
A4 Thursday, April 21st at 9:00pm

Here is the grading information for this assignment:

Automatic Grades of 0 awarded for the following reasons:
[1] If the code does not compile.
[2] If the code does not run.
[3] If the student does not specify in the comments which keys control the light cycles.

[A] Initial Configuration (24 points)
(6%) [A1] A JFrame with a DrawingCanvas appears when the game starts.
(6%) [A2] A Reset button appears when the game starts.
(6%) [A3] The first light cycle appears on the screen when the game starts.
(6%) [A4] The second light cycle appears on the screen when the game starts.

[B] Directional Movement (40 points)
(7%) The first light cycle turns up when the correct key is pressed.
(7%) The first light cycle turns down when the correct key is pressed.
(7%) The first light cycle turns right when the correct key is pressed.
(7%) The first light cycle turns left when the correct key is pressed.
(12%) The second light cycle turns all four directions when different keys are pressed (3 points each direction)

[C] Moving light cycles (28 points)
(9%) The key to move the first light cycle causes it to move (irrespective of currently facing direction)
(13%) The key to move the first light cycle causes it to move in the direction the light cycle is currently facing
(6%) The key to mvoe the second light cycle causes it to move in the direction the light cycle is currently facing

[D] Reset button functionality (8 points)
(4%) Pushing the reset button causes both light cycles to return to their original positions
(4%) Pushing the reset button causes both light cycles to return to their original orientations

CSE 115/503 - Spring 2011 - Footer