pygame detecting mouse cursor over object
问题 I want to print a statement when the mouse cursor hovers over an image I loaded onto the screen, but it only prints when the mouse cursor hovers over the top left portion of the screen even if the image is in the center or bottom right. import pygame, sys from pygame import * def main(): pygame.init() FPS = 30 fpsClock = pygame.time.Clock() screen = pygame.display.set_mode((600, 400)) cat = pygame.image.load('cat.png') while True: if cat.get_rect().collidepoint(pygame.mouse.get_pos()): print