Commit 108e1d6c authored by Bruno Freitas Tissei's avatar Bruno Freitas Tissei
Browse files

Empurrar pedras

1 merge request!1Cuidado do caso de explosao nas bordas do jogo e adicionado movimento de empurrao de pedras
Showing with 10 additions and 2 deletions
+10 -2
......@@ -214,7 +214,7 @@ 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'){
/*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';
......@@ -223,7 +223,7 @@ void renderMap(map *m, int time) {
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++)
......
......@@ -22,6 +22,10 @@ void updateRockford(rockford *player, map *m, int action) {
m->grid[player->y][player->x] = '5';
player->diamonds++;
player->score += m->score;
} else if (right == '6' && m->grid[player->y+2][player->x] == '0') {
m->grid[player->y++][player->x] = '0';
m->grid[player->y][player->x] = '5';
m->grid[player->y+1][player->x] = '6';
}
} else if (action == 4) {
char left = m->grid[player->y-1][player->x];
......@@ -33,6 +37,10 @@ void updateRockford(rockford *player, map *m, int action) {
m->grid[player->y][player->x] = '5';
player->diamonds++;
player->score += m->score;
} else if (left == '6' && m->grid[player->y-2][player->x] == '0') {
m->grid[player->y--][player->x] = '0';
m->grid[player->y][player->x] = '5';
m->grid[player->y-1][player->x] = '6';
}
} else if (action == 2) {
char down = m->grid[player->y][player->x+1];
......
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