1
Graphics / Re: Getting a rect from a shape/implementing collision detection
« on: May 14, 2013, 11:31:15 am »
Thanks mate, that example helped quite a lot. No more escaping paddles.
I'm still confused about Rect's though, like how can I actually use it after using getGlobalBounds(). I've tried stuff like if paddle1.x or paddle1.top (at least 'top' was an attribute on a Rect) has a value that puts them out of the screen, it will be adjusted so the paddle can't exit the screen. This hasn't been working at all, as I get compile error:
(Apologies for bad text, I felt nauseous after reading it too.)
I'm still confused about Rect's though, like how can I actually use it after using getGlobalBounds(). I've tried stuff like if paddle1.x or paddle1.top (at least 'top' was an attribute on a Rect) has a value that puts them out of the screen, it will be adjusted so the paddle can't exit the screen. This hasn't been working at all, as I get compile error:
error: 'class sf::RectangleShape' has no member named 'top'
Obviously it's still using Shape, so how am I able to use Rect instead?(Apologies for bad text, I felt nauseous after reading it too.)