@@ -14,9 +14,11 @@ public class Grid
14
14
int width = 0 ;
15
15
int color = 0 ;
16
16
Player player ;
17
+ String playerEmote ;
17
18
Randomizer rand = new Randomizer ();
18
- public Grid (int width , int height , int boxCount ) //create a random grid with specific width, height, and number of boxes
19
+ public Grid (int width , int height , int boxCount , String playerEmote ) //create a random grid with specific width, height, and number of boxes
19
20
{
21
+ this .playerEmote = playerEmote ;
20
22
player = new Player (2 , 2 , this );
21
23
if (boxCount > MAX_BOXES )
22
24
{
@@ -129,31 +131,31 @@ public void updateGrid()
129
131
{
130
132
for (int j = 0 ; j < width ; j ++)
131
133
{
132
- grid [j ][i ] = new Tile (GROUND );
134
+ grid [j ][i ] = new Tile (GROUND , playerEmote );
133
135
if (j == 0 || j == width - 1 || i == 0 || i == height - 1 )
134
136
{
135
- grid [j ][i ] = new Tile (WALL , color );
137
+ grid [j ][i ] = new Tile (WALL , color , playerEmote );
136
138
}
137
139
for (int k = 0 ; k < boxCount ; k ++)
138
140
{
139
141
if (destinations [k ].getX () == j && destinations [k ].getY () == i )
140
142
{
141
- grid [j ][i ] = new Tile (DESTINATION );
143
+ grid [j ][i ] = new Tile (DESTINATION , playerEmote );
142
144
}
143
145
}
144
146
if (player .getX () == j && player .getY () == i )
145
147
{
146
- grid [j ][i ] = new Tile (PLAYER );
148
+ grid [j ][i ] = new Tile (PLAYER , playerEmote );
147
149
}
148
150
for (int k = 0 ; k < boxCount ; k ++)
149
151
{
150
152
if (boxes [k ].getX () == j && boxes [k ].getY () == i )
151
153
{
152
154
if (boxes [k ].onDestination ())
153
155
{
154
- grid [j ][i ] = new Tile (WALL , color );
156
+ grid [j ][i ] = new Tile (WALL , color , playerEmote );
155
157
} else {
156
- grid [j ][i ] = new Tile (BOX );
158
+ grid [j ][i ] = new Tile (BOX , playerEmote );
157
159
}
158
160
159
161
}
0 commit comments