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

Author Topic: Intersection  (Read 2719 times)

0 Members and 1 Guest are viewing this topic.

lohr

  • Newbie
  • *
  • Posts: 15
    • View Profile
Intersection
« on: June 25, 2008, 11:32:30 am »
Hello,

I am want to program a little racer game, so i have to check for the border of my race circuit.
Now I was wondering about, that the Sprite class has no function "intersects" but rectangle has it?

How could I solve my problem best, because my car sure has to move :) Could i use a Rect instead of Sprite or are there other possibilities?

Best regards,
Alex "lohr"

Regen

  • Newbie
  • *
  • Posts: 42
    • View Profile
    • Email
Intersection
« Reply #1 on: June 25, 2008, 11:42:28 am »
Was'nt there a new function in 1.3?
IsPointInside, play around whith that one?
Why can't things just work?

lohr

  • Newbie
  • *
  • Posts: 15
    • View Profile
Intersection
« Reply #2 on: June 25, 2008, 12:01:29 pm »
Hm i cant find this function...in which class is it?

EDIT:
I will do it now with an invisible Rect Object and the contains() method.
If you have better solutions, let me know ;)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Intersection
« Reply #3 on: June 25, 2008, 12:17:07 pm »
It's still in the roadmap, which means it hasn't been implemented in version 1.3.

However you can do it quite easily. The only tricky part is if you need to apply any rotation.
Laurent Gomila - SFML developer

lohr

  • Newbie
  • *
  • Posts: 15
    • View Profile
Intersection
« Reply #4 on: June 26, 2008, 07:35:44 am »
Hm ive done it now with the contains-method from rect :) and i calculate the 3 other edges every time...

 

anything