SFML community forums

Help => General => Topic started by: Loopback on April 25, 2014, 11:32:39 am

Title: Resize bounding boxes?
Post by: Loopback 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!
Title: Re: Resize bounding boxes?
Post by: eXpl0it3r 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. ;)
Title: Re: Resize bounding boxes?
Post by: Geheim 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.
Title: Re: Resize bounding boxes?
Post by: Loopback 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!
Title: Re: Resize bounding boxes?
Post by: eXpl0it3r 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. ;)