In the move
method, it is necessary to set the variables new_x
and new_y
differently:
For upward movement:
new_x = old_x
new_y = old_y + 1
"And down:"
new_x = old_x
new_y = old_y - 1
This code sets the value of new_x
to be the same as old_x
, and sets the value of new_y
to be one less than the value of old_y
.