Search:

Type: Posts; User: geforce

Page 1 of 2 1 2

Search: Search took 0.21 seconds.

  1. Replies
    60
    Views
    1,861

    Re: Making a method to move blocks in a grid

    sigh... -.-
  2. Replies
    60
    Views
    1,861

    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. Replies
    60
    Views
    1,861

    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. Replies
    60
    Views
    1,861

    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 addbrick (list created)
    perform row * ROWSEPARATION + ROWZERO
    perform...
  5. Replies
    60
    Views
    1,861

    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. Replies
    60
    Views
    1,861

    Re: Making a method to move blocks in a grid

    6) and 7) and computed together and added to the list?
  7. Replies
    60
    Views
    1,861

    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
    perform addbrick
    create i
    create j
    perform i * j
    add (i * j) to list...
  8. Replies
    60
    Views
    1,861

    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
    perform addbrick
    perform i added to j
    add (i added to j) to location of list
  9. Replies
    60
    Views
    1,861

    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
    perform addbrick
    perform i added to j
    add (i added to j) to location of list
  10. Replies
    60
    Views
    1,861

    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. Replies
    60
    Views
    1,861

    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. Replies
    60
    Views
    1,861

    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. Replies
    60
    Views
    1,861

    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. Replies
    60
    Views
    1,861

    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. Replies
    60
    Views
    1,861

    Re: Making a method to move blocks in a grid

    for i
    do i = i * ROWSEPARATION + ROWZERO

    for j
    do j = j * BLOCKWIDTH
  16. Replies
    60
    Views
    1,861

    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. Replies
    60
    Views
    1,861

    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. Replies
    60
    Views
    1,861

    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. Replies
    60
    Views
    1,861

    Re: Making a method to move blocks in a grid

    oh maybe for 4) I do for(GRect e : l) this.add(e);
  20. Replies
    60
    Views
    1,861

    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. Replies
    60
    Views
    1,861

    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. Replies
    60
    Views
    1,861

    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. Replies
    60
    Views
    1,861

    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. Replies
    60
    Views
    1,861

    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. Replies
    60
    Views
    1,861

    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 2