Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- #define MAP_SIZE 13
- int main()
- {
- int i=0;
- int j=0;
- int px=(MAP_SIZE-1) /2;
- int py=(MAP_SIZE-1) /2;
- char map[MAP_SIZE*MAP_SIZE] = {
- '#','#','#','#','#','#','-','#','#','#','#','#','#', //da finire
- '#','#','#','#','#','#','-','#','#','#','#','#','#',
- '#','#','.','.','.','.','.','.','.','.','#','#','#',
- '#','#','.','.','.','.','.','.','.','.','#','#','#',
- '#','#','.','.','.','.','.','.','.','.','#','#','#',
- '#','#','.','.','.','.','.','.','.','.','#','#','#',
- '#','#','.','.','.','.','.','.','.','.','#','#','#',
- '#','#','.','.','.','.','.','.','.','.','#','#','#',
- '#','#','.','.','.','.','.','.','.','.','#','#','#',
- '#','#','.','.','.','.','.','.','.','.','#','#','#',
- '#','#','#','#','#','#','-','#','#','#','#','#','#',
- '#','#','#','#','#','#','-','#','#','#','#','#','#',
- };
- while(true)
- {system("cls");
- for (int i=0; i<MAP_SIZE; i++){
- for(j=0; j<MAP_SIZE; j++){
- if((j==px) && (i==py))
- {
- cout<<"@";
- }
- else{
- cout<<map[i*MAP_SIZE+j];
- }
- }
- cout<<"\n";
- }
- char input=0;
- cin>>input;
- if(input=='w') && il_terreno_รจ_libero
- {
- py=py-1;
- }
- else if(input=='a')
- {
- px=px-1;
- }
- else if(input=='s')
- {
- py=py+1;
- }
- else if(input=='d')
- {
- px=px+1;
- }
- if (py==-1){
- if (input=='w'){
- py=MAP_SIZE-1;
- }
- }
- if(py==10){
- if(input=='s'){
- py=0;
- }
- }
- if(px==-1){
- if(input=='a'){
- px=MAP_SIZE-1;
- }
- }
- if(px==10){
- if(input=='d'){
- px=0;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement