[Help]Make a Breakout Game - CS106A
Hello, programmers!
I take the free stanford CS106A course, however I take 1 month break and as a result I have a little remembrance on what I learn.
So I'm on breakout assignment right now, previously I just want to skip over due to its complexity but somewhat I'm just feel guilty to do it and I also do not want to copy other people's code.
I need your guide on how to decompose this problem. From the handout, I was told to build the brick first but sadly I don't know how to start. Indeed I'd build several programs from CS106A but it's still quite hard in this assignment on how to figure out the decomposition.
Could you give me a clue/hints?
Your help would greatly appreciated. Thanks :)
Code:
/*
* File: Breakout.java
* -------------------
* Name:
* Section Leader:
*
* This file will eventually implement the game of Breakout.
*/
import acm.graphics.*;
import acm.program.*;
import acm.util.*;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class Breakout extends GraphicsProgram {
/** Width and height of application window in pixels */
public static final int APPLICATION_WIDTH = 400;
public static final int APPLICATION_HEIGHT = 600;
/** Dimensions of game board (usually the same) */
private static final int WIDTH = APPLICATION_WIDTH;
private static final int HEIGHT = APPLICATION_HEIGHT;
/** Dimensions of the paddle */
private static final int PADDLE_WIDTH = 60;
private static final int PADDLE_HEIGHT = 10;
/** Offset of the paddle up from the bottom */
private static final int PADDLE_Y_OFFSET = 30;
/** Number of bricks per row */
private static final int NBRICKS_PER_ROW = 10;
/** Number of rows of bricks */
private static final int NBRICK_ROWS = 10;
/** Separation between bricks */
private static final int BRICK_SEP = 4;
/** Width of a brick */
private static final int BRICK_WIDTH =
(WIDTH - (NBRICKS_PER_ROW - 1) * BRICK_SEP) / NBRICKS_PER_ROW;
/** Height of a brick */
private static final int BRICK_HEIGHT = 8;
/** Radius of the ball in pixels */
private static final int BALL_RADIUS = 10;
/** Offset of the top brick row from the top */
private static final int BRICK_Y_OFFSET = 70;
/** Number of turns */
private static final int NTURNS = 3;
/* Method: run() */
/** Runs the Breakout program. */
public void run() {
GLabel welcome = new GLabel("Welcome to Breakout, Dude");
}
public void gameSetup() {
createBricks();
}
private void createBricks() {
}
}
Re: [Help]Make a Breakout Game - CS106A
Sounds like you need to go back to the basics and play catch up. You can't just miss a month of your curriculum and expect to hit the ground running.
Re: [Help]Make a Breakout Game - CS106A
Quote:
Originally Posted by
KevinWorkman
Sounds like you need to go back to the basics and play catch up. You can't just miss a month of your curriculum and expect to hit the ground running.
My bad :( . Did you mean I should repeat it from the beginning?
Re: [Help]Make a Breakout Game - CS106A
Quote:
Originally Posted by
YLTO
My bad :( . Did you mean I should repeat it from the beginning?
Start from wherever you feel comfortable. If that's the beginning, then yes.
Think about it- if somebody is trying to learn calculus, they can't just skip algebra. If you're trying to learn how to program, you can't skip sections, or you'll have no idea what's going on. Even if we got this code to work for you, you wouldn't actually be learning anything.