에서 이미지 마우스를 움직일 감지가?나는 이미지가 파이 게임
button_x = 0
button_y = 0
newGameButton = pygame.image.load("images/newGameButton.png").convert_alpha()
x_len = newGameButton.get_width()
y_len = newGameButton.get_height()
mos_x, mos_y = pygame.mouse.get_pos()
if mos_x>button_x and (mos_x<button_x+x_len):
x_inside = True
else: x_inside = False
if mos_y>button_y and (mos_y<button_y+y_len):
y_inside = True
else: y_inside = False
if x_inside and y_inside:
#Mouse is hovering over button
screen.blit(newGameButton, (button_x,button_y))
, 더 mouse in pygame에뿐만 아니라 surfaces in pygame으로 읽기 :
그리고 두 개 이상의 버튼이나 표면이있는 경우, 그것을 당신은 커서를 이동 매번에 대해 검사 할 목록을 확인하십시오. –