im trying to create moving character program as the user moves the character it erases its last position. however my while loops aren't working, also i would like to terminate the program by pressing x.
is there any way of doing this:
code:
#include<iostream>
#include"110ct.h"
#include<string>
using namespace std;
int main()
{
string A,
char Move;
char X;
double xval ,yval;
xval= 25;// the set x postion coordinates
yval = 25;//the set x postion coordinates
cl.setBackground(Yellow);// will set the background to yellow
cout<< " to move the special character press the following keys \n";
cout<< " press i for up \n k for down \n j for left and l for right \n";// intructions for the keys
cl.setForeground(Aqua);
cout <<" Please enter a character to move please \n";
cin >> A;// the character the user wants to move
cout << " now you can start to move your character \n";
qin >> Move;// this will allow the user to move the character chosen
while( Move = "i")
{
yval = yval + 0.5;
cout << A << endl;
crs.clearAll();// this will clear the screen after the user moves the character again
}
I tried doing this myself and its quite hard and not a good idea in Console, but thats probably not going to stop you anyways. Im not sure how to erase the last poisition and all that but to end the program when x is pressed do this:
1 2 3 4 5 6 7 8
#define VK_X 0x58
int x;
x=GetAsyncKeyState(0x58);
if(x){
cin.get();
}