L29 - 2! Read the marking schedule CompSci 101 SSC! There...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CS101 Assignment 3 1 CompSci 101 SSC Assignment 4 – Break Out 2 Read the marking schedule There are 12 stages in assignment 4. After every stage, check the marking schedule. 3 The Files For A4 4 Using the constants provided public class BreakOutConstants { public static final Rectangle GAME_AREA = … ; public static final Rectangle BALL_START_RECT = … ; public static final int PADDLE_MOVE_AMOUNT= … ; } ... public class BreakOutJPanel extends JPanel … { ... public void drawGameArea(Graphics g) { g.fillRect( BreakOutConstants .GAME_AREA.x, … } } ... public class Paddle { private Rectangle area; public void moveRight() { area.x += BreakOutConstants .PADDLE_MOVE_AMOUNT; } } 5 Planning It is a good idea before you start writing any source code to have an idea of how the classes are going to interact and how you are going to use them. In particular, it is important to plan what data each class is going to store, and what methods each class should support. 6 Planning BreakOutJPanel bricks ball paddle brickColours t gameIsOver ... BreakOutJPanel() reset() actionPerformed(ActionEvent e) keyPressed(KeyEvent e) pantComponent(Graphics g) createBricks() ... Brick area colour isVisible ... Brick(. ..) isVisible() makeInvisible() getRect() drawBrick(Graphics g) ... Paddle area ... Paddle() getRect() moveLeft() moveRight() drawPaddle(Graphics g) Ball area changeInX changeInY isMoving ... Ball() resetBall() getRect() moveBall(. ..) drawBall(Graphics g) ... x y width height Brick area colour isVisible ... Brick(. ..) isVisible() makeInvisible() getRect() drawBrick(Graphics g) ... x y width height x y width height x y width height ...
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CS101 Assignment 3 2 7 Classes involved These classes are required for launching the program and creating the window. This is the JPanel class which deals with all the events such as the key presses and the action events from the Timer object. This class is responsible for managing the behaviour
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/01/2012 for the course COMPSCI 101 taught by Professor Adrianaferraro during the Summer '12 term at Auckland.

Page1 / 4

L29 - 2! Read the marking schedule CompSci 101 SSC! There...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online