Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <stdlib.h>
- using namespace std;
- int main()
- {
- int xpos=0;
- int ypos=0;
- int i;
- int y;
- char input;
- int map[50][50];
- map[xpos][ypos] = 69;
- for(;;)
- {
- for(i=0;i<50;i++)
- {
- for(y=0;y<50;y++)
- {
- if(map[i][y]==69)
- {
- cout << "E";
- }
- else
- {
- cout << " ";
- }
- }
- cout << endl;
- }
- cout << endl;
- cin >> input;
- if(input=='s')
- {
- if(xpos<49)
- {
- map[xpos][ypos] = 0;
- xpos++;
- }
- }
- else if(input=='w')
- {
- if(xpos>0)
- {
- map[xpos][ypos] = 0;
- xpos--;
- }
- }
- if(input=='d')
- {
- if(ypos<49)
- {
- map[xpos][ypos] = 0;
- ypos++;
- }
- }
- else if(input=='a')
- {
- if(ypos>0)
- {
- map[xpos][ypos] = 0;
- ypos--;
- }
- }
- map[xpos][ypos] = 69;
- system("CLS");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement