SFML community forums

Help => General => Topic started by: codingHere on October 16, 2021, 01:16:01 am

Title: how to detect if sprite is touching other sprite w/ specific texture
Post by: codingHere 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?  ??? :-\ :-\ :-\
Title: Re: how to detect if sprite is touching other sprite w/ specific texture
Post by: G. 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