Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Stone(int type, Position pos) {
- this.pos = pos;
- this.type = type;
- switch(this.type) {
- case 1:
- value = 5;
- color = Color.LIGHT_GRAY;
- break;
- case 2:
- value = 10;
- color = Color.orange;
- break;
- case 3:
- value = 15;
- color = Color.green;
- break;
- }
- }
- private void drawStones(Graphics2D g2) {
- stones = view.getGame().getLevel().getStones();
- for (int i = 0; i < stones.length; i++) {
- for (int j = 0; j < stones[1].length; j++) {
- int x_position = (int) stones[i][j].getPosition().getX();
- int y_position = (int) stones[i][j].getPosition().getY();
- if(stones[i][j].getType() >= 1) {
- g2.setColor(stones[i][j].getColor());
- g2.fillRoundRect(x_position, y_position,
- (int) ((double)Constants.SCREEN_WIDTH/Constants.SQUARES_X)-2,
- (int) ((double)Constants.SCREEN_HEIGHT/Constants.SQUARES_Y)-2 ,1,1);
- }
- }
- }
- }
- private void updateStonesAndScore() {
- int posLine = ball.getHitStonePosition().getLine();
- int posColumn = ball.getHitStonePosition().getColumn();
- score = score + stones[posLine][posColumn].getValue();
- System.out.println(stones[posLine][posColumn].getType());
- stones[posLine][posColumn].setColor(stones[posLine][posColumn].getColor());
- stones[posLine][posColumn].setType(stones[posLine][posColumn].getType()-1);
- }
Add Comment
Please, Sign In to add comment