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

Author Topic: Resize bounding boxes?  (Read 2466 times)

0 Members and 2 Guests are viewing this topic.

Loopback

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Resize bounding boxes?
« on: April 25, 2014, 11:32:39 am »
Hi there! I'd like to know if there's a way to resize bounding boxes. I'm coding a game in which I want my pj's enemies to detect him in a wide area and I'd like to know how can do that.

Thanks in advance!

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Resize bounding boxes?
« Reply #1 on: April 25, 2014, 11:37:43 am »
The Wiki subforum is not for help questions.

Bounding box of what exactly?

The bounds you get from a sprite represent the visual aspect. A good code design separates the visual part from the logical part. So in essence just use your own sf::Rect<T> object and set its size as large as you want. ;)
« Last Edit: April 25, 2014, 12:53:09 pm by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Geheim

  • Full Member
  • ***
  • Posts: 201
    • View Profile
    • Email
Re: Resize bounding boxes?
« Reply #2 on: April 25, 2014, 12:16:19 pm »
I think he meant the "detection bounding box".
Just use a radius and check if an enemy is near the player, no need of resizing anything.
Unless you want a rectangular detection area, then you can use what was said above.
Failing to succeed does not mean failing to progress!

Loopback

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: Resize bounding boxes?
« Reply #3 on: April 25, 2014, 12:59:13 pm »
I think he meant the "detection bounding box".
Just use a radius and check if an enemy is near the player, no need of resizing anything.
Unless you want a rectangular detection area, then you can use what was said above.

A radius?? what you mean?

The Wiki subforum is not for help questions.

Bounding box of what exactly?

The bounds you get from a sprite represent the visual aspect. A good code design separates the visual part from the logical part. So in essence just use your own sf::Rect<T> object and set its size as large as you want. ;)


I'm really sorry T_T I will delete the topic as soon as possible!

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Resize bounding boxes?
« Reply #4 on: April 25, 2014, 01:18:34 pm »
I'm coding a game in which I want my pj's enemies to detect him in a wide area and I'd like to know how can do that.
You might want to use a line of sight algorithm.

I'm really sorry T_T I will delete the topic as soon as possible!
You can't, just use the correct forum (help section) next time. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/