Answers for "how to make a object point at mouse in pygame"

3

mouse in pygame

pygame.mouse.get_pos() #-> get the mouse cursor position on the screen in taple
#-> (x, y)

if event.type == pygame.MOUSEBUTTONDOWN:
    print(event.button)

#------------------------#
1 - left click
2 - middle click
3 - right click
4 - scroll up
5 - scroll down
#------------------------#
Posted by: Guest on July-28-2021
2

pygame mouse pos

pygame.mouse.get_pos()
    get the mouse cursor position
    get_pos() -> (x, y)

    Returns the x and y position of the mouse cursor. 
    The position is relative to the top-left corner of the display. 
    The cursor position can be located outside of the display window,
    but is always constrained to the screen.
Posted by: Guest on February-01-2021

Code answers related to "how to make a object point at mouse in pygame"

Python Answers by Framework

Browse Popular Code Answers by Language