Hi, first question. How would you input movement into a program?
I'm using Borland C++. To define my question a little better: I want to make a game where you move an asterisk around the screen. Well, I have the key movement, but I don't know how to show the space between where the asterisk was and where it is now. Here's the code:
#include <conio.h>
#include <iostream.h>
#define left arrow = 'A'
#define up arrow = 'Q'
#define down arrow = 'Z'
#define right arrow = 'S'
void main()
{
cout << "YOU NEED CAPS-LOCKS ON TO RUN THE PROGRAM" << endl;
cout << endl << "Controls: " << endl;
cout << "S Right" << endl;
cout << "A Left" << endl;
cout << "Q Up" << endl;
cout << "Z Down" << endl << endl;
cout << "*";
char spc[2]=" ";//Space for movement
int lp=1;
while(lp!=0)
{
char ch;
ch = getch();
if(ch == 'S')//Right
{
clrscr();
cout << "--*";
}
if(ch == 'A')//Left
{
clrscr();
cout << "*--";
}
if(ch == 'Q')//Up
{
clrscr();
cout << "I" << endl << "*";
}
if(ch == 'Z')//Down
{
clrscr();
cout << "*" << endl << "I";
}
}
}