32 lines
1.0 KiB
Java
32 lines
1.0 KiB
Java
package ruscz.game.gameOfProd.Cells;
|
|
|
|
import ruscz.game.gameOfProd.Image.ImageCell;
|
|
import ruscz.game.gameOfProd.Windows.WindowOfFreeMove;
|
|
|
|
import java.awt.*;
|
|
|
|
public class Block extends Cell {
|
|
private ImageCell imageCell;
|
|
|
|
public Block() {
|
|
super(-1, -1, WindowOfFreeMove.CELL_SIZE, Color.BLUE);
|
|
}
|
|
|
|
public Block(int x, int y, ImageCell imageCell) {
|
|
super(x, y, WindowOfFreeMove.CELL_SIZE, Color.BLUE);
|
|
this.imageCell = imageCell;
|
|
}
|
|
|
|
public boolean isInBlock(int x, int y) {
|
|
return (this.
|
|
getX() == x) && (this.getY() == y);
|
|
}
|
|
|
|
@Override
|
|
public void paint(Graphics2D g) {
|
|
super.paint(g);
|
|
g.fillOval(getX() * WindowOfFreeMove.CELL_SIZE, getY() * WindowOfFreeMove.CELL_SIZE, WindowOfFreeMove.CELL_SIZE, WindowOfFreeMove.CELL_SIZE);
|
|
g.drawImage(imageCell.getImagesOfTiles().get(102), getX() * WindowOfFreeMove.CELL_SIZE,
|
|
getY() * WindowOfFreeMove.CELL_SIZE, WindowOfFreeMove.CELL_SIZE, WindowOfFreeMove.CELL_SIZE, null);
|
|
}
|
|
} |