Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: sprite detection by coordinates  (Read 1566 times)

0 Members and 1 Guest are viewing this topic.

Reiv

  • Newbie
  • *
  • Posts: 13
    • View Profile
sprite detection by coordinates
« on: June 18, 2011, 08:35:15 pm »
Hi I couldn't figure how I can the application detect if eg. some mouse over some Sprite.
I have background sprite, character sprite and some npc sprite etc. I can get coordinates of every sprite by sf::sprite name.GetPosition(), but is there some other way around? Can I somehow get sf::sprite object by using coordinates.
For example I get mouse coordinates and I want to know if there is some sprite on this coordinates.
Thanks  :oops:

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
sprite detection by coordinates
« Reply #1 on: June 18, 2011, 08:58:06 pm »
No, you can't do that without some special implementation. I suggest keeping a list of every sprite that exists somewhere, and when you want to find one at a certain position, go through the list looking for one that is at that position.
I use the latest build of SFML2