Whew! i did it.
k first i added two more global variables to the gpmain.c
int py, px, ex, ey, exmax, eymax, edgex = 160 , edgey = 120;
Then, in the GameEngine() procedure...
void GameEngine()
{
while(1)
{
HandleInput();
ex = px - edgex;
ey = py - edgey;
if (ex < 0) ex = 0;
if...