WarpPI/core/src/main/java/it/cavallium/warppi/extra/tetris/TetrisGame.java

34 lines
775 B
Java
Raw Normal View History

2018-10-05 16:00:15 +02:00
package it.cavallium.warppi.extra.tetris;
public class TetrisGame {
2018-10-09 17:45:20 +02:00
private static final int WIDTH = 10, HEIGHT = 22;
private BlockType[] grid;
private BlockType[] hovergrid;
private GameStatus gameStatus = GameStatus.INITIAL;
private int score = 0;
private double currentTime = 0;
2018-10-05 16:00:15 +02:00
public TetrisGame() {
}
2018-10-06 16:37:44 +02:00
void playAgain() {
2018-10-05 16:00:15 +02:00
grid = new BlockType[WIDTH * HEIGHT];
hovergrid = new BlockType[WIDTH * HEIGHT];
score = 0;
2018-10-09 17:45:20 +02:00
currentTime = 0;
2018-10-05 16:00:15 +02:00
gameStatus = GameStatus.PLAYING;
}
2018-10-09 17:45:20 +02:00
public void gameTick(float dt, boolean leftPressed, boolean rightPressed, boolean downPressed, boolean okPressed,
boolean backPressed) {
currentTime += dt;
if (gameStatus == GameStatus.INITIAL) {
playAgain();
} else {
}
}
2018-10-05 16:00:15 +02:00
}