public class WallState
extends java.lang.Object
Modifier and Type | Class | Description |
---|---|---|
class |
WallState.WallData |
this class is a subclass foe wall state that saves the data of the wall
|
Modifier and Type | Field | Description |
---|---|---|
int |
h |
|
int |
numColumns |
|
int |
numRows |
|
int |
w |
Constructor | Description |
---|---|
WallState(int GAME_WIDTH,
int GAME_HEIGHT) |
create the walls for the game
|
Modifier and Type | Method | Description |
---|---|---|
java.lang.String |
findMapPath() |
choose a map randomly
|
WallState.WallData |
getWallForBullet(int x,
int y) |
to know that bullet can get this position or not
|
java.util.ArrayList<WallState.WallData> |
getWalls() |
|
boolean |
isWallForTank(int x,
int y) |
to know that tank can get this position or not
|
void |
loadWalls() |
this method is for drawing the walls
|
void |
paintComponent(java.awt.Graphics g) |
thois method is for drawing components
|
void |
setSource(java.lang.String mapPath) |
set the path of the map
|
public int numRows
public int numColumns
public int w
public int h
public WallState(int GAME_WIDTH, int GAME_HEIGHT)
GAME_WIDTH
- is the width of the frameGAME_HEIGHT
- is the height of the framepublic void paintComponent(java.awt.Graphics g)
g
- is the graphic which we use itpublic void loadWalls()
public WallState.WallData getWallForBullet(int x, int y)
x
- is the x of tanky
- is the y of tankpublic boolean isWallForTank(int x, int y)
x
- is the x of tanky
- is the y of tankpublic java.lang.String findMapPath()
public void setSource(java.lang.String mapPath) throws java.io.IOException
mapPath
- java.io.IOException
public java.util.ArrayList<WallState.WallData> getWalls()