sigh... -.-
Type: Posts; User: geforce
sigh... -.-
When row is at 0 the row goes to 50
When column is at 0 the column goes to 0
When row is at 1 the row goes to 100
When the column is at 1 the column goes to 50
The row is always ahead of the...
Is Y also computed outside the loop?
It says that:
The i'th row of blocks has its upper edge aligned with i (row) * ROWSEPARATION +ROWZERO.
The j'th column of blocks has its left edge...
for every row equal to 0 to BLOCKROWS
for every column equal to 0 to NBLOCKS
create x
create y
create colour
perform addbrick (list created)
perform row * ROWSEPARATION + ROWZERO
perform...
Do you mean the variables in i and j?
if so i is the row and j is the column ohhh, so
create row
create column
6) and 7) and computed together and added to the list?
for every i equal to 0 to BLOCKROWS
for every j equal to 0 to NBLOCKS
create x and y to compute location
create colour
perform addbrick
create i
create j
perform i * j
add (i * j) to list...
for every i equal to 0 to BLOCKROWS
for every j equal to 0 to NBLOCKS
perform addbrick
perform i added to j
add (i added to j) to location of list
for every i equal to 0 to BLOCKROWS
for every j equal to 0 to NBLOCKS
perform addbrick
perform i added to j
add (i added to j) to location of list
i and j are put on a grid, j depends on i, so..
for i
for j
do i * j? still not sure
and then put into the list?
The row is vertically seperated and then moved to a location
The column is enlarged at that rows location
ROWZERO is the vertical offset, in pixels from the top of the screen to the top of the first row of
blocks
ROWSEPARATION is the vertical separation between rows.
So for every i on the upper...
Maybe that is iterated through every i and put into the block same with j'th column.
Thats exactly where I'm lost, have no Idea about what to do with that code i just know i*ROWSEPARATION + ROWZERO is supposed to be implemented, I have no idea where though, same with j'th column.
for i
do i = i * ROWSEPARATION + ROWZERO
for j
do j = j * BLOCKWIDTH
"do things needed for this row", "do things needed for this column" is missing is that a typo? and also for "do things needed for this row" would it be i = i * ROWSEPARATION + ROWZERO; or is there a...
Yes they do but I didn't make it keep track of the row and column or is that automatic because its a for-loop
public static java.util.List<acm.graphics.GRect> createPlayfield()
{
Random r = new Random();
List<GRect> l = null;
int x = 0;
int y = ROWZERO - BLOCKHEIGHT;
Color c =...
oh maybe for 4) I do for(GRect e : l) this.add(e);
4) I'm not sure.. I have to place the GRects onto the grid, probably would be l.add(i,j) or l.add(x,y) because of the coordinates? Maybe l.setLocation(x,y)...
3) it would be...
Also since the grid has a size would I need to put a loop for that?
public static java.util.List<acm.graphics.GRect> createPlayfield()
{
Random r = new Random();
List<GRect> l = null;
int x = 0;
int y = ROWZERO - BLOCKHEIGHT;
Color...
This should give you a good example the methods are used in this program.
import acm.graphics.*;
import acm.program.*;
import java.awt.Color;
import java.util.Random;
import...
You're thinking way too complicated, there are no arrays in this at all.
This program is based on a game breakout http://www.arcadebond.com/games/images/breakout_game.jpg
The package imported...
1) Create a static method (createPlayfield)
2) Each GRect is randomly coloured
3) Each GRect is of size BLOCKWIDTH x BLOCKHEIGHT
4) The blocks are placed in an grid
5) The grid is of size...