well you can get your boundries in wed and use an if statment
in your movement code ... lets say your boundries are -1000 and
1000

if(player.x<1000)
{player_movent.x + = 10*(key_a)*time;
}
if(player.x>-1000)
{player_movent.x - = 10*(key_d)*time;
}


someting like that