The image in the div #TheMovingDiv starts at a certain location, set by CSS and matched by the global variables originalx and originaly. TheMovingDiv moves using WASD keys.
The image in TheMovingDiv is set to be very small (only 10x10 pixels) in this example.
TheMovingDiv can't go:
- further left than an x of 200
- or further right than an x of 400
- or higher than a y of 250
- or lower than a y of 650
...because 4 if statements prevent it.
TheMovingDiv position is counted from its top left corner.