Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool colisao(SDL_Rect pRetangulo1, SDL_Rect pRetangulo2){
- int vEsquerdo1;
- int vEsquerdo2;
- int vDireito1;
- int vDireito2;
- int vTopo1;
- int vTopo2;
- int vRodape1;
- int vRodape2;
- vEsquerdo1 = pRetangulo1.x;
- vDireito1 = pRetangulo1.x + pRetangulo1.w;
- vTopo1 = pRetangulo1.y;
- vRodape1 = pRetangulo1.y + pRetangulo1.h;
- vEsquerdo2 = pRetangulo2.x;
- vDireito2 = pRetangulo2.x + pRetangulo2.w;
- vTopo2 = pRetangulo2.y;
- vRodape2 = pRetangulo2.y + pRetangulo2.h;
- if (vRodape1 <= vTopo2) return false;
- if (vTopo1 >= vRodape2) return false;
- if (vDireito1 <= vEsquerdo2) return false;
- if (vEsquerdo1 >= vDireito2) return false;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement