Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
General
»
how to detect if sprite is touching other sprite w/ specific texture
Print
Pages: [
1
]
Author
Topic: how to detect if sprite is touching other sprite w/ specific texture (Read 4243 times)
0 Members and 1 Guest are viewing this topic.
codingHere
Newbie
Posts: 6
how to detect if sprite is touching other sprite w/ specific texture
«
on:
October 16, 2021, 01:16:01 am »
i got this goin on
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
if (grid
[j] == 2)
{
Sprite sprite;
FloatRect Entity::dirtTexture() {
return sprite.GetPosition().x,
sprite.GetPosition().y,
sprite.GetSize().x,
sprite.GetSize().y,
}
bool Entity::Collides( *) {
return myRect().Intersects(e->myRect());
};
if ()
{
sprite.setTexture(grassTexture);
}
else
{
sprite.setTexture(dirtTexture);
}
sprite.setPosition(i * 218, j * 216);
window.draw(sprite);
}
}
cout << "\n";
i dont know whats wrong can you guys help?
Logged
G.
Hero Member
Posts: 1593
Re: how to detect if sprite is touching other sprite w/ specific texture
«
Reply #1 on:
October 16, 2021, 12:43:44 pm »
If you don't know what's happening, how could we? Maybe describe a little bit more your problem if you want people to help you...
It doesn't even look like real code
Logged
Print
Pages: [
1
]
SFML community forums
»
Help
»
General
»
how to detect if sprite is touching other sprite w/ specific texture
anything