Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
Graphics
»
[SOLVED]Check for sprite collision
Print
Pages: [
1
]
Author
Topic: [SOLVED]Check for sprite collision (Read 1677 times)
0 Members and 1 Guest are viewing this topic.
Antonio9227
Newbie
Posts: 25
[SOLVED]Check for sprite collision
«
on:
October 02, 2013, 03:51:29 pm »
Is there any way to check if 2 sprites are collided?
«
Last Edit: October 03, 2013, 05:21:31 pm by Antonio9227
»
Logged
zsbzsb
Hero Member
Posts: 1409
Active Maintainer of CSFML/SFML.NET
Re: Check for sprite collision
«
Reply #1 on:
October 02, 2013, 04:06:04 pm »
There are tons of ways to do this, but without any more information have a look at this.
if
(
sprite1.
getGlobalBounds
(
)
.
intersects
(
sprite2.
getGlobalBounds
(
)
)
)
{
//Collision
}
Logged
Motion / MotionNET
- Complete video / audio playback for SFML / SFML.NET
NetEXT
- An SFML.NET Extension Library based on
Thor
Antonio9227
Newbie
Posts: 25
Re: Check for sprite collision
«
Reply #2 on:
October 02, 2013, 04:07:30 pm »
Thanks for the fast reply
Logged
Print
Pages: [
1
]
SFML community forums
»
Help
»
Graphics
»
[SOLVED]Check for sprite collision
anything