The following code runs code if these conditions are met:
- User clicks on a surface called
box
- the
box
must be moving in at least one direction
if ((boxLeft < pygame.mouse.get_pos()[0] < boxLeft + BOX_SIZE) and (boxTop < pygame.mouse.get_pos()[1] < boxTop + BOX_SIZE)) and ((dx != 0) and (dy != 0)):
This does not happen. Instead, the code only runs if the box is moving in both directions (if both do not dx and dy == 0)