// Обновляет положение палуб взависимости от координат и поворота public void update() { if (field == null) return; if (rotated) { int x = this.x; for (int i = 0; i < decks.size(); i++) { field.getCell(x, y).addDeck(decks.get(i)); x++; } } else { int y = this.y; for (int i = 0; i < decks.size(); i++) { field.getCell(x, y).addDeck(decks.get(i)); y++; } } }
public void selectCell(int row, int col) { if (!field.cellExists(row, col)) { clearSelectedCell(); return; } Cell currentCell = field.getCell(row, col); if (!currentCell.isEmpty()) { selectedCell = currentCell; } else if (!noSelectedCell() && currentCell.isEmpty()) { moveBallAction.moveBall(selectedCell, currentCell); clearSelectedCell(); } }
public boolean hasCollision(Field f) { Cell cell = f.getCell(this.location.x, this.location.y); if (cell == null) return false; return (this.state == CellType.SHAPE && (cell.isSolid() || cell.isBlock())); }