synchronized void drop(Board board) {
int [][] a = getArray();
int [][] b = board.getArray();
//I don't have currentObject here... what do I need to write? ...
Type: Posts; User: wholegrain
synchronized void drop(Board board) {
int [][] a = getArray();
int [][] b = board.getArray();
//I don't have currentObject here... what do I need to write? ...
How do we refer to the currentPiece object inside drop()?
synchronized void drop(Board board) {
int [][] a = getContents();
int [][] b = board.getContents();
...
for some reason i can't remove static...
this doesn't work:
board = board.getContents();
shape = currentPiece.getContents();
--- Update ---
currentPiece.contents should not stop falling (fall()) until it touches the last row of board or another contents
--- Update ---
Ohhhh... I knoww!!
Can you tell me how I can do this:
a =...
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
Is it because of legalDown() and rotateCounterClockWise() running concurrently?
--- Update ---
the tetris block stops before it lands on another block or the floor...
legalDown is supposed...
ok nevermind. geeze. ummm when i rotate the objects the shape aren't updated for some reason and they land before they hit anything
--- Update ---
umm i just commented out printarray for...
Help!! When I print the array of board, I only get 0s. Do you know why?
The pieces aren't there...
Some information that might be helpful
In the Piece class, you'll want methods for moving the piece down, moving it left and right by one column, and for rotating the piece clockwise and...
I think I need to update shape when I rotate. Do you have any idea how to do this? Because it fills up the array as if they weren't rotated at all... Do I have to write a new method?
Any tip for debugging?
Uhmm, I had called addArray in two different places, now I only have it in fall();
and I remove updateLocation() in 2 places
Now, it kinda works, but there's an...
damnit ... OK it kinda works now, but when I rotate an object there are 2 shapes that are created...
lol
http://s12.postimage.org/5c6afasmz/noooo.jpg
public class Piece extends Grid {...
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 30
at Board.legalDownSpec(Board.java:74)
at Board.legalDown(Board.java:122)
at Piece.fall(Piece.java:92)
at...
if(shape[row][col] == 1 && row == 7)
{
return false;
}
would this fix it? if row indexes was between 6 and 0, wouldn't this cause an arrayoutofbound?
--- Update ---
public class collisiontest
{
public static boolean legalDownSpec(int currentX, int currentY, int[][] board, int[][] shape, int index)
{
int x = currentX+1;
int y = currentY;
...
http://s18.postimage.org/k2snvv0rb/dfdf_3.jpg
It somewhat works, but I need the pieces to go all the way down, and I think there is a problem with updateLocation(), because sometimes it doesn't...
How do we debug this. I really have a hard trouble debugging the program and understanding why so many things are going wrong.
Ok... I added the following
if(x + row == 32)
{
return false;
}
Well great... it compiles, but I get this:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
at Board.legalDown(Board.java:75)
at Piece.fall(Piece.java:77)
at...
Microsoft Windows [Version 6.0.6002]
Copyright (c) 2006 Microsoft Corporation. All rights reserved.
C:\Users\->cd C:\Users\-\Desktop\tetris\tocomplete
...
I think I solved most of the problems, but there is something wrong with the getter method...
void fall(Board board) {
int [][] a = getContents();
int [][] b = board.getContents();
int [][] a = currentPiece.getContents();
int [][] b = board.getContents();
wait.. these doesn't work, because currentPiece and board aren't created yet? Is that it? So, how do I solve this...
Are you sure about that? Because it gives me cannot find symbol when I remove it. It doesn't seem to inherit the method. So how would you go about doing the following:
void fall() {
int...
I know basic inheritance, but this program is a lot more complex, so it kinda different from the examples I saw.
I did write this a long time ago, but I don't know how I would use it in this case:...
I need to access contents, but do you know how considering that contents is declared in Grid? I thought about declaring contents in Piece and Board, but I don't know if that will work.
Write a...