Line 22 and 23 should be in your main loop. And I recommend you to change variable name (DX and DY) because they are already used in your main loop.