-
Notifications
You must be signed in to change notification settings - Fork 1
/
GamePlayGround.java
57 lines (43 loc) · 1.43 KB
/
GamePlayGround.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**
* this class represent a playground for game
*
* @author Sevda Imany
* @version 0.0.0
*/
public class GamePlayGround {
int[][]newMap = {
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,1},
{1,0,0,2,2,2,2,2,0,0,2,2,2,2,0,0,2,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,1,0,1,1,1,2,0,2,2,2,2,2,2,2,2,2,2,1},
{1,0,0,0,0,0,0,1,1,1,0,1,2,0,0,0,1,0,0,0,2,0,0,0,1},
{1,0,0,0,0,0,0,1,1,1,0,1,2,0,0,0,1,0,0,0,2,0,0,0,1},
{1,2,2,2,2,2,2,1,1,1,0,1,2,0,0,0,1,0,0,0,2,0,0,0,1},
{1,0,0,0,0,0,0,1,1,1,0,1,2,0,0,0,1,0,0,0,2,0,0,0,1},
{1,0,0,0,0,0,0,1,1,1,0,1,2,0,0,0,1,0,0,0,2,0,0,0,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
};
/* Constructor */
/**
* create a new playground
*/
public GamePlayGround(){
GameState.newWalls();
TileGrid tileGrid =new TileGrid(newMap);
tileGrid.draw();
GameState.setHeightPLayGround((newMap.length- 0.5) * 45);
GameState.setWidthPLayGround((newMap[0].length- 0.5) *45);
}
public void render(){
doRendering();
}
private void doRendering(){
for (Tank tank:GameState.getTanks()){
tank.draw();
}
for (Ammo ammo: GameState.getFiredAmmos()){
ammo.draw();
}
}
}