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

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
    • View Profile
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?  ??? :-\ :-\ :-\

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
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

 

anything