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

Author Topic: Is this possible?  (Read 1177 times)

0 Members and 1 Guest are viewing this topic.

The Terminator

  • Full Member
  • ***
  • Posts: 224
  • Windows and Mac C++ Developer
    • View Profile
Is this possible?
« on: August 13, 2012, 01:56:55 am »
For my collision detection, is it possible to create a sprite and assign it a sf::Rect<int> for collision checking? If this is possible, would it be easier and more simple than comparing the height + width with just a sprite? I know you can use contains to see if two rects are intersecting, but how would I use it with a sprite?
Current Projects:
Technoport

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10821
    • View Profile
    • development blog
    • Email
Re: Is this possible?
« Reply #1 on: August 13, 2012, 09:40:58 am »
sprite.getGlobalBounds() will return a sf::FloatRect which you then can test against other rects or points to check for collision. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

The Terminator

  • Full Member
  • ***
  • Posts: 224
  • Windows and Mac C++ Developer
    • View Profile
Re: Is this possible?
« Reply #2 on: August 13, 2012, 01:44:12 pm »
Ah yes, of course  ;D hadn't even thought of that, thanks.
Current Projects:
Technoport

 

anything