You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
694 B
32 lines
694 B
package com.study.tank;
|
|
|
|
import java.awt.*;
|
|
|
|
/**
|
|
* @author xsj
|
|
* @date 2022/10/28 15:37
|
|
*/
|
|
public class Wall extends GameObject {
|
|
int width;
|
|
int height;
|
|
public GameModel gm;
|
|
public Rectangle rectangle;
|
|
|
|
public Wall(int x, int y, int width, int height, GameModel gameModel) {
|
|
this.x = x;
|
|
this.y = y;
|
|
this.width = width;
|
|
this.height = height;
|
|
this.gm = gameModel;
|
|
rectangle = new Rectangle(x, y, width, height);
|
|
}
|
|
|
|
@Override
|
|
public void paint(Graphics g) {
|
|
Color c = g.getColor();
|
|
g.setColor(Color.GRAY);
|
|
g.fillRect(this.x, this.y, this.width, this.height);
|
|
g.setColor(c);
|
|
}
|
|
}
|