Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <stdio.h>
- #include <windows.h>
- using namespace std;
- /*
- This is the map.
- X = 4
- Y = 3
- @XXX
- XXXX
- XXXX
- */
- int mainLoop()
- {
- int y = 0; // PLayer Y
- int x = 0; //Player X
- int xMax = 3;
- int yMax = 2;
- int xMin = 0;
- int yMin = 0;
- string dir;
- string name; // Used later
- bool endGame = false;
- while(endGame == false)
- {
- cout << x << y << endl;
- printf("\nEnter a L or R for Left and Right: ");
- cin >> dir;
- if(dir == "L" && x >= xMin && x <= xMax)
- {
- printf("You Went Left");
- x--;
- }
- else if(dir == "R" && x <= 3 && x >= 0)
- {
- printf("You Went Right");
- x++;
- }
- else
- {
- printf("You can't go that way.");
- }
- }
- }
- int main()
- {
- mainLoop();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement