removed cause of tetris collision bugs (yaw, pitch in Pos)

This commit is contained in:
2026-02-03 17:18:28 +01:00
parent f95c670514
commit ffba86ac41

View File

@@ -44,7 +44,7 @@ public class Tetromino {
this.position = new Pos(newPosition.x(), newPosition.y(), newPosition.z()); this.position = new Pos(newPosition.x(), newPosition.y(), newPosition.z());
} }
public boolean rotate(boolean clockwise) { public void rotate(boolean clockwise) {
int[][] newShapeArray = this.getTurnedShapeArray(clockwise); int[][] newShapeArray = this.getTurnedShapeArray(clockwise);
Orientation newOrientation = this.orientation.rotated(clockwise); Orientation newOrientation = this.orientation.rotated(clockwise);
@@ -53,11 +53,10 @@ public class Tetromino {
Pos candidate = new Pos(this.position.x() + k[0], this.position.y() + k[1], this.position.z()); Pos candidate = new Pos(this.position.x() + k[0], this.position.y() + k[1], this.position.z());
if(this.checkCollisionAndMove(candidate, newShapeArray)) { if(this.checkCollisionAndMove(candidate, newShapeArray)) {
this.orientation = newOrientation; this.orientation = newOrientation;
return true; return;
} }
} }
return false;
} }
public boolean moveDown() { public boolean moveDown() {
@@ -65,14 +64,14 @@ public class Tetromino {
return this.checkCollisionAndMove(newPosition, this.shapeArray); return this.checkCollisionAndMove(newPosition, this.shapeArray);
} }
public boolean moveLeft() { public void moveLeft() {
Pos newPosition = this.position.sub(1, 0, 0); Pos newPosition = this.position.sub(1, 0, 0);
return this.checkCollisionAndMove(newPosition, this.shapeArray); this.checkCollisionAndMove(newPosition, this.shapeArray);
} }
public boolean moveRight() { public void moveRight() {
Pos newPosition = this.position.add(1, 0, 0); Pos newPosition = this.position.add(1, 0, 0);
return this.checkCollisionAndMove(newPosition, this.shapeArray); this.checkCollisionAndMove(newPosition, this.shapeArray);
} }
public void draw() { public void draw() {