# Search:

Type: Posts; User: geforce

Page 1 of 2 1

by geforce
Replies
60
Views
1,872

sigh... -.-
2. ## Thread: Making a method to move blocks in a grid

by geforce
Replies
60
Views
1,872

### Re: Making a method to move blocks in a grid

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...
3. ## Thread: Making a method to move blocks in a grid

by geforce
Replies
60
Views
1,872

### Re: Making a method to move blocks in a grid

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...
4. ## Thread: Making a method to move blocks in a grid

by geforce
Replies
60
Views
1,872

### Re: Making a method to move blocks in a grid

for every row equal to 0 to BLOCKROWS
for every column equal to 0 to NBLOCKS
create x
create y
create colour
perform row * ROWSEPARATION + ROWZERO
perform...
5. ## Thread: Making a method to move blocks in a grid

by geforce
Replies
60
Views
1,872

### Re: Making a method to move blocks in a grid

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. ## Thread: Making a method to move blocks in a grid

by geforce
Replies
60
Views
1,872

### Re: Making a method to move blocks in a grid

6) and 7) and computed together and added to the list?
7. ## Thread: Making a method to move blocks in a grid

by geforce
Replies
60
Views
1,872

### Re: Making a method to move blocks in a grid

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
create i
create j
perform i * j
add (i * j) to list...
8. ## Thread: Making a method to move blocks in a grid

by geforce
Replies
60
Views
1,872

### Re: Making a method to move blocks in a grid

for every i equal to 0 to BLOCKROWS
for every j equal to 0 to NBLOCKS
9. ## Thread: Making a method to move blocks in a grid

by geforce
Replies
60
Views
1,872

### Re: Making a method to move blocks in a grid

for every i equal to 0 to BLOCKROWS
for every j equal to 0 to NBLOCKS
10. ## Thread: Making a method to move blocks in a grid

by geforce
Replies
60
Views
1,872

### Re: Making a method to move blocks in a grid

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?
11. ## Thread: Making a method to move blocks in a grid

by geforce
Replies
60
Views
1,872

### Re: Making a method to move blocks in a grid

The row is vertically seperated and then moved to a location

The column is enlarged at that rows location
12. ## Thread: Making a method to move blocks in a grid

by geforce
Replies
60
Views
1,872

### Re: Making a method to move blocks in a grid

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...
13. ## Thread: Making a method to move blocks in a grid

by geforce
Replies
60
Views
1,872

### Re: Making a method to move blocks in a grid

Maybe that is iterated through every i and put into the block same with j'th column.
14. ## Thread: Making a method to move blocks in a grid

by geforce
Replies
60
Views
1,872

### Re: Making a method to move blocks in a grid

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.
15. ## Thread: Making a method to move blocks in a grid

by geforce
Replies
60
Views
1,872

### Re: Making a method to move blocks in a grid

for i
do i = i * ROWSEPARATION + ROWZERO

for j
do j = j * BLOCKWIDTH
16. ## Thread: Making a method to move blocks in a grid

by geforce
Replies
60
Views
1,872

### Re: Making a method to move blocks in a grid

"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...
17. ## Thread: Making a method to move blocks in a grid

by geforce
Replies
60
Views
1,872

### Re: Making a method to move blocks in a grid

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
18. ## Thread: Making a method to move blocks in a grid

by geforce
Replies
60
Views
1,872

### Re: Making a method to move blocks in a grid

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 =...
19. ## Thread: Making a method to move blocks in a grid

by geforce
Replies
60
Views
1,872

### Re: Making a method to move blocks in a grid

oh maybe for 4) I do for(GRect e : l) this.add(e);
20. ## Thread: Making a method to move blocks in a grid

by geforce
Replies
60
Views
1,872

### Re: Making a method to move blocks in a grid

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...
21. ## Thread: Making a method to move blocks in a grid

by geforce
Replies
60
Views
1,872

### Re: Making a method to move blocks in a grid

Also since the grid has a size would I need to put a loop for that?
22. ## Thread: Making a method to move blocks in a grid

by geforce
Replies
60
Views
1,872

### Re: Making a method to move blocks in a grid

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...
23. ## Thread: Making a method to move blocks in a grid

by geforce
Replies
60
Views
1,872

### Re: Making a method to move blocks in a grid

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...
24. ## Thread: Making a method to move blocks in a grid

by geforce
Replies
60
Views
1,872

### Re: Making a method to move blocks in a grid

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...
25. ## Thread: Making a method to move blocks in a grid

by geforce
Replies
60
Views
1,872

### Re: Making a method to move blocks in a grid

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...
Results 1 to 25 of 33
Page 1 of 2 1