I am making a Tetris clone and I am using a tick method for the game loop (not sure if this is necessary). I want to increase the y value of the block object by 50 pixels every second or so. Can I add some type of delay in my tick method, or is there an easier way?
public class SquareBlock extends GameObject{
public SquareBlock(int x, int y, ID id){
super(x,y,id);
}
public void tick(){
y += 50;
}
public void render(Graphics g){
g.setColor(Color.red);
g.fillRect(x, y, 50, 50);
g.fillRect(x, y + 50, 50, 50);
g.fillRect(x + 50, y, 50, 50);
g.fillRect(x + 50, y + 50, 50, 50);
}
}
Thanks