Wednesday, January 1, 2014

Day 9, New Year, Box Collision solved!

New year and new thoughts. I solved the collision problem we had! Hurrah!
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 made it so that the ball stays on the playerObject until it gets shot even if the player moves.


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