Skip to content

Commit

Permalink
Movimentação dos jogadores -> Não é permitido atravessar as paredes, …
Browse files Browse the repository at this point in the history
…nem andar dentro delas
  • Loading branch information
williamtorres1 committed Jun 25, 2018
1 parent 30024d0 commit 02d148b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions código fonte/jogo do labirinto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ void movimentacao1(int *hp1,int *ouro1,int init_x,int init_y, int *x,int *y,int
if(tecla1 == 'a' || tecla1 == 'A')
{
(*y)--;
if(mapa1[(*x)][(*y)]==0)
if(mapa1[(*x)][(*y)]==8)
{ (*y)++;
passos++;
}
Expand Down Expand Up @@ -453,7 +453,7 @@ void movimentacao1(int *hp1,int *ouro1,int init_x,int init_y, int *x,int *y,int
if(tecla1 == 'd' || tecla1 == 'D')
{
(*y)++;
if(mapa1[(*x)][(*y)]==0)
if(mapa1[(*x)][(*y)]==8)
{ (*y)--;
passos++;
}
Expand Down Expand Up @@ -573,7 +573,7 @@ void movimentacao2(int *hp2, int *ouro2,int init_x,int init_y, int *x,int *y,int
*/
if(tecla1 == 5)
{ (*x)++;
if(mapa1[(*x)][(*y)]==8)
if(mapa1[(*x)][(*y)]==0)
{ (*x)--;
passos++;
}
Expand Down Expand Up @@ -620,7 +620,7 @@ void movimentacao2(int *hp2, int *ouro2,int init_x,int init_y, int *x,int *y,int
if(tecla1 == 4)
{
(*y)--;
if(mapa1[(*x)][(*y)]==0)
if(mapa1[(*x)][(*y)]==8)
{ (*y)++;
passos++;
}
Expand Down Expand Up @@ -665,7 +665,7 @@ void movimentacao2(int *hp2, int *ouro2,int init_x,int init_y, int *x,int *y,int
if(tecla1 == 6)
{
(*y)++;
if(mapa1[(*x)][(*y)]==0)
if(mapa1[(*x)][(*y)]==8)
{ (*y)--;
passos++;
}
Expand Down Expand Up @@ -843,6 +843,8 @@ void map()
}*/
init_x=x; init_y=y; init_w = w; init_z=z;
/* Enviar o init_x e etc como argumento para o procedimento show_map(), para mostrar onde os jogadores escolheram iniciar */
mapa1[init_x][init_y]=5;
mapa1[init_w][init_z]=6;
while(ouro1 < 1 && ouro2 < 1 && hp1 > 0 && hp2 > 0)
{
show_map(mapa1);
Expand Down
Binary file added código fonte/jogo do labirinto.exe
Binary file not shown.
Binary file added código fonte/jogo do labirinto.o
Binary file not shown.

0 comments on commit 02d148b

Please sign in to comment.