Commit 82c4690c authored by Ivo Júnior's avatar Ivo Júnior
Browse files

Cuidado do caso de explosao nas bordas do jogo e adicionado movimento de empurrao de pedras

parent 0d6905ba
......@@ -119,25 +119,43 @@ void updateMap(map *m, int action) {
} else {
waittime++;
if (waittime < 21) {
m->grid[player.y-1][player.x-1] = 'x';
m->grid[player.y][player.x-1] = 'x';
m->grid[player.y+1][player.x-1] = 'x';
m->grid[player.y-1][player.x] = 'x';
m->grid[player.y][player.x] = 'x';
m->grid[player.y+1][player.x] = 'x';
m->grid[player.y-1][player.x+1] = 'x';
m->grid[player.y][player.x+1] = 'x';
m->grid[player.y+1][player.x+1] = 'x';
if(m->grid[player.y-1][player.x-1] != '1')
m->grid[player.y-1][player.x-1] = 'x';
if(m->grid[player.y][player.x-1] != '1')
m->grid[player.y][player.x-1] = 'x';
if(m->grid[player.y+1][player.x-1] != '1')
m->grid[player.y+1][player.x-1] = 'x';
if(m->grid[player.y-1][player.x] != '1')
m->grid[player.y-1][player.x] = 'x';
if(m->grid[player.y][player.x] != '1')
m->grid[player.y][player.x] = 'x';
if(m->grid[player.y+1][player.x] != '1')
m->grid[player.y+1][player.x] = 'x';
if(m->grid[player.y-1][player.x+1] != '1')
m->grid[player.y-1][player.x+1] = 'x';
if(m->grid[player.y][player.x+1] != '1')
m->grid[player.y][player.x+1] = 'x';
if(m->grid[player.y+1][player.x+1] != '1')
m->grid[player.y+1][player.x+1] = 'x';
} else if (waittime <= 100) {
m->grid[player.y-1][player.x-1] = '0';
m->grid[player.y][player.x-1] = '0';
m->grid[player.y+1][player.x-1] = '0';
m->grid[player.y-1][player.x] = '0';
m->grid[player.y][player.x] = '0';
m->grid[player.y+1][player.x] = '0';
m->grid[player.y-1][player.x+1] = '0';
m->grid[player.y][player.x+1] = '0';
m->grid[player.y+1][player.x+1] = '0';
if(m->grid[player.y-1][player.x-1] != '1')
m->grid[player.y-1][player.x-1] = '0';
if(m->grid[player.y][player.x-1] != '1')
m->grid[player.y][player.x-1] = '0';
if(m->grid[player.y+1][player.x-1] != '1')
m->grid[player.y+1][player.x-1] = '0';
if(m->grid[player.y-1][player.x] != '1')
m->grid[player.y-1][player.x] = '0';
if(m->grid[player.y][player.x] != '1')
m->grid[player.y][player.x] = '0';
if(m->grid[player.y+1][player.x] != '1')
m->grid[player.y+1][player.x] = '0';
if(m->grid[player.y-1][player.x+1] != '1')
m->grid[player.y-1][player.x+1] = '0';
if(m->grid[player.y][player.x+1] != '1')
m->grid[player.y][player.x+1] = '0';
if(m->grid[player.y+1][player.x+1] != '1')
m->grid[player.y+1][player.x+1] = '0';
} else if (waittime > 100)
readFileMap(m, mapnumber);
}
......@@ -196,6 +214,16 @@ void renderMap(map *m, int time) {
renderChar(ext, i, j, offx, offy, 5);
break;
case('5'):
if (player.dir == 4 && m->grid[i-1][j] == '6' && m->grid[i-2][j] == '0'){
m->grid[--player.y][player.x] = '5';
m->grid[i-2][j] = '6';
m->grid[i][j] = '0';
}
else if (player.dir == 6 && m->grid[i+1][j] == '6' && m->grid[i+2][j] == '0'){
m->grid[++player.y][player.x] = '5';
m->grid[i+2][j] = '6';
m->grid[i][j] = '0';
}
attron(COLOR_PAIR(6));
for (k = 0; k < 3; k++)
for (l = 0; l < 6; l++)
......@@ -210,9 +238,9 @@ void renderMap(map *m, int time) {
case('6'):
if (m->grid[i][j+1] == '0')
m->grid[i][j] = 'f';
if (m->grid[i][j+1] == '6' && m->grid[i+1][j] == '0' && m->grid[i+1][j+1] == '0')
if ((m->grid[i][j+1] == '6' || m->grid[i][j+1] == 'w' || m->grid[i][j+1] == 'z') && m->grid[i+1][j] == '0' && m->grid[i+1][j+1] == '0')
m->grid[i][j] = 'r';
if (m->grid[i][j+1] == '6' && m->grid[i-1][j] == '0' && m->grid[i-1][j+1] == '0')
if ((m->grid[i][j+1] == '6' || m->grid[i][j+1] == 'w' || m->grid[i][j+1] == 'z') && m->grid[i-1][j] == '0' && m->grid[i-1][j+1] == '0')
m->grid[i][j] = 'l';
for (k = 0; k < 3; k++)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment