Hey.
I am wanting to make this program so that the user can move the position of his characters. I have made a attempt but i am confused about some bits.
// Code Shark
#include <iostream>
using namespace std;
int main() {
char character = 'X', movement;
do {
system("Cls");
cout << "Do you want your character to move [L]eft, [R]ight, [U]p or";
cout << " [D]own or [E]xit: ";
cin >> movement;
switch (movement)
{
case 'L':
cout << "\b" << character;
break;
case 'R':
cout << " " << character;
break;
case 'U':
//cout << ???;
break;
case 'D':
cout << endl << character;
/* the thing is if i just go endl here the character will
go straight to the start of the new line and most likelys
the character will be spaces away from it. */
break;
case 'E':
break;
}
}
while(movement != 'E');
cin.get();
return 0;
}
Some of the problems include: At the start of the Do loop the characters position will be deleted in my code because of the system clear. Another worry is that when the user wants to move up or down the character will be brought to the start of the line and that may not be directly under/above the last position. If you could help i would be very graceful.