Trying to animate the filling of the board.

This is just for educational purposes and at no means necessary for the game.
Yeah I'm pretty productive LOL
This commit is contained in:
2020-07-27 00:52:42 +02:00
parent 5f795bfc60
commit 818786cfba
18 changed files with 198 additions and 81 deletions

35
ConnectFour/src/Chip.java Normal file
View File

@@ -0,0 +1,35 @@
import javax.imageio.ImageIO;
import javax.swing.text.Position;
import java.awt.*;
import java.io.File;
import java.io.IOException;
public class Chip {
private String path = "ConnectFour/res/yellowChip.png";
private Point position;
private boolean isRed;
private Image chip;
public Chip(String path, boolean isRed, int tileWidth, int tileHeight) {
this.isRed = isRed;
position = new Point();
try {
chip = ImageIO.read(new File(path)).getScaledInstance(tileWidth - 15, tileHeight - 15, Image.SCALE_DEFAULT);
} catch (IOException e) {
e.printStackTrace();
}
}
public Image getImage() { return chip; }
public boolean isRed(){
return isRed;
}
public void setPosition(int x, int y){
position.setLocation(x, y);
}
public Point getPosition() {
return position;
}
}