When collision was checked it checked all the objects in the ObjectManager including checking collision against PlayerObject vs PlayerObject. The Player sprite and collider is is 27 x 6 pixels so the 6 pixels wrong came from that somehow. When I took that out of the equation it worked perfectly! PlayerObject shouldn't be able to collide with itself anyway.
I then rebuilt the whole Ball class we had so it inherit from the GameObject class and have a BoxCollider to start with to test functionallity of the game. The collision of the ball is okay but sometimes the ball get stuck in the wall. It might be because I made it so speed is added to the ball with every collision. Something that needs more testing.
I also started working with a CollisionManager so we can handle more kinds of collisions and handle it in a better way. I will continue this work tomorrow. If time permits I will also look at seperating loading of the bricks and the destruction of them.
No comments:
Post a Comment