Hello, I've made a small program which has shark object moving across the screen. I want detect when the sharks touch the submarine object at the other side. I have placed a rectangle around both objects but when I run the program its a bit buggy. The texture no longer shows for either object and sometimes only 1 rectangle shows. Collision detection doesn't work at all. I've posted my code below in the hopes that someone can spot something. thanks.
//spriteBatch inside the render() method
//WorldUtils class that both Shark class and SUbmarine class extend
hey, I should have mentioned that I was using the framework LibGDX. It has a built in Vector2 class, which has an x,y coordinate system for making games. Its makes moving objects a lot simpler. sharks is an ArrayLisst is of type Shark, which is a class I made. Here is the class:
I thought I had to maintain a position so I can set the bounds to that position. I'm also updating the position every frame. I got the bounds.intersects() working earlier but I did something to stop it again. I think it will just take some fiddling around with.