Permalink
Browse files

Cleanup and changed TPiece to rotate in middle of piece.

  • Loading branch information...
1 parent e3341da commit 2540e249f72264c363a4b053aebba742c1fd5a90 chris dillon committed Apr 6, 2009
Showing with 24 additions and 22 deletions.
  1. +1 −2 IPiece.pde
  2. +4 −0 OPiece.pde
  3. +5 −6 PlayState.pde
  4. +14 −14 TPiece.pde
View
@@ -24,8 +24,7 @@ class IPiece extends Piece {
}
public void setRotation(float angle) {
- println(angle);
-
+ // this just rotates two ways back and forth
if(angle >= radians(0.0f) && angle <= radians(90.0f)) {
this.rotation = radians(90.0f);
} else if (angle >= radians(90.0f) && angle <= radians(180.0f)) {
View
@@ -21,6 +21,10 @@ class OPiece extends Piece {
super.round(blocks[3]);
}
+ public void setRotation(float angle) {
+ // do nothing and like it
+ }
+
/* Call this whenever moving or rotating */
public void update() {
View
@@ -178,6 +178,7 @@ public class PlayState implements GameState {
}*/
// side colli test
+ /*
int tmp = gridSizeY-1;
for (int k=0; k<8; k++){
@@ -187,7 +188,7 @@ public class PlayState implements GameState {
}
}
tmp--;
- }
+ }*/
}
@@ -534,8 +535,6 @@ public class PlayState implements GameState {
}
}
-
-
// new piece HERE
//currentPiece = new LPiece(playField[1].getX() / 2, 32.0f);
//currentPiece = pieceBag.getPiece();
@@ -609,7 +608,7 @@ public class PlayState implements GameState {
int x = fx.intValue() - 2;
if (x > 0) {
int y = fy.intValue() - 1;
- println("testing:" + x + "," + y);
+ //println("testing:" + x + "," + y);
// we hit something on the grid
if(deadGrid[x-1][y-1] != null) {
println("deny left");
@@ -679,7 +678,7 @@ public class PlayState implements GameState {
//println (columns[i]);
// store the least Y value for yStart later
- println("YB:" + yBlocks[i].getX() + "," + yBlocks[i].getY());
+ //println("YB:" + yBlocks[i].getX() + "," + yBlocks[i].getY());
}
// search down columns with Y in current piece
@@ -707,7 +706,7 @@ public class PlayState implements GameState {
// remember where we hit the grid
hitPoints.add(hitPoint);
- println(hitPoint.getX() + "," + hitPoint.getY() + "hitsomething=" + hitSomething);
+ //println("hitPoints: " + hitPoint.getX() + "," + hitPoint.getY() + "hitsomething=" + hitSomething);
}
}
}
View
@@ -1,8 +1,8 @@
class TPiece extends Piece {
/*
- # 0 441144 (purple)
- ### 123
+ # 2 441144 (purple)
+ ### 103
*/
public TPiece(float x, float y) {
@@ -60,14 +60,14 @@ class TPiece extends Piece {
public void update() {
offsetX[0] = 0;
- offsetX[1] = sin(rotation + radians(225)) * (blockSize + (blockSize / 2));
- offsetX[2] = sin(rotation + radians(180)) * blockSize;
- offsetX[3] = sin(rotation + radians(135)) * (blockSize + (blockSize / 2));
+ offsetX[1] = sin(rotation + radians(270)) * blockSize;
+ offsetX[2] = sin(rotation + radians(0)) * blockSize;
+ offsetX[3] = sin(rotation + radians(90)) * blockSize;
offsetY[0] = 0;
- offsetY[1] = cos(rotation + radians(45)) * (blockSize + (blockSize / 2));
- offsetY[2] = cos(rotation + radians(0)) * blockSize;
- offsetY[3] = cos(rotation + radians(315)) * (blockSize + (blockSize / 2));
+ offsetY[1] = cos(rotation + radians(90)) * blockSize;
+ offsetY[2] = cos(rotation + radians(180)) * blockSize;
+ offsetY[3] = cos(rotation + radians(270)) * blockSize;
for (int i=0; i<4; i++) {
blocks[i].setX(super.pivotPoint.getX() + offsetX[i]);
@@ -87,14 +87,14 @@ class TPiece extends Piece {
testRotation = rotation + radians(90.0f);
testOffsetX[0] = 0;
- testOffsetX[1] = sin(testRotation + radians(225)) * (blockSize + (blockSize / 2));
- testOffsetX[2] = sin(testRotation + radians(180)) * blockSize;
- testOffsetX[3] = sin(testRotation + radians(135)) * (blockSize + (blockSize / 2));
+ testOffsetX[1] = sin(testRotation + radians(270)) * blockSize;
+ testOffsetX[2] = sin(testRotation + radians(0)) * blockSize;
+ testOffsetX[3] = sin(testRotation + radians(90)) * blockSize;
testOffsetY[0] = 0;
- testOffsetY[1] = cos(testRotation + radians(45)) * (blockSize + (blockSize / 2));
- testOffsetY[2] = cos(testRotation + radians(0)) * blockSize;
- testOffsetY[3] = cos(testRotation + radians(315)) * (blockSize + (blockSize / 2));
+ testOffsetY[1] = cos(testRotation + radians(90)) * blockSize;
+ testOffsetY[2] = cos(testRotation + radians(180)) * blockSize;
+ testOffsetY[3] = cos(testRotation + radians(270)) * blockSize;
// round our test offsets to blocksize
for (int i=0; i<4; i++) {

0 comments on commit 2540e24

Please sign in to comment.