I am making a simple side scrolling space shooter game using Libgdx and everything is going nicely. However until now I haven't been testing collisions for my players ship with other ships. I have lasers colliding with baddie ships using simple rectangle overlap method that exists already in libgdx.
But the "white/transparent" space around the edge of many of my sprites is quite a lot and when i am now applying the code to check collision with my player it is happening from a long way off from actual collision. In the past I used XNA Framework C# and there was quite a simple way to do a box collision and then within that test if both pixels in question where transparent and ONLY WHEN both pixels were NOT transparent would it return true as a collision.
I'm really struggling to find this method or how to implement this using LibGDX , can anyone help me out here??
Here is the code snippet in question, if you need the full games code please let me know:
if (ship.getBoundingRectangle().overlaps(baddiePurple.getBoundingRectangle())){
purpleDyingSound.play();
KillPurpleSoloEnemy();
game.setScreen(new MenuScreen(game));
}
Of course I'm aware that I could just trim down all the images to have almost zero transparent edges but the problem with doing that is they are animated sprites in sprite-sheets and i can't get them into the right position if I try that. (Also, I plan on having LOTS of different enemies etc and trimming would be a major ballache)
THANKS IN ADVANCE FOR ANY HELP! peace out!