1) you should update oldx and oldy everytime you move
2) however, will you find useful to know if the collision gets triggered on a specific axis?
(eg. may be you could want to know if the collision between 2 sprites is lateral - along the x - or vertical - along the y - if you want to change direction for something or so)
3) if your problem is just about stop moving, and not about restoring old coordinates, you should try something like
(direction assignment code, probably based on cursor keys, here)
if (collision code condition here)
xdirection = 0
ydirection = 0
endif
x = xdirection * xspeed
y = ydirection * yspeed
sprite 1, x, y, 1
.
Bye, Berserk.
.