K
K
Konstantin2020-08-11 19:27:22
pygame
Konstantin, 2020-08-11 19:27:22

How to add mouseover events to a sprite in pygame?

I'm making a game where you can break blocks and put (something like) in 2d on pygame.
I wanted to make it so that when the user hovered the mouse over the block, the block would have white borders, but I did not know how to do it!
Plz, help me to do something, I will be very grateful.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rostislav, 2020-10-23
@Rostyslav23

There is a pygame.mouse.get_pos() function in PyGame that gets the cursor coordinates. Further through if you compare coordinates.
Website: https://question-it.com/questions/550827/pochemu-m...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question