Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

getting cursor position in py game

import pygame
cursor_position = pygame.mouse.get_pos()
#returns a tuple : (x, y) of cursor
print(cursor_position)
print(f'X pos of cursor is : {cursor_position[0]}')
print(f'Y pos of cursor is : {cursor_position[1]}')
 
PREVIOUS NEXT
Tagged: #cursor #position #py #game
ADD COMMENT
Topic
Name
3+7 =