Possible Duplicate:
jQuery/Javascript collision detection
I am learning how to code in JavaScript, and im using the jQuery library. I have a player that moves around the screen with the WASD keys. I want him to stop when he comes to the boundaries of the game. I am using two div
s, one is called playground (the area where the game takes place) and another called player. I have them set up like this:
<div id="playground">
<div id="player"></div>
</div>
The player moves great but I want him to stop when he gets to the edge of the playground. Please explain your answer in depth because I'm new to JavaScript programming. Any help would be much appreciated.