Sunday, April 10, 2011

Fireman Rendering

Problem: The fire hose would not show the correct angle when the mouse was pointing below where the player stood. When the mouse would pass under the players position on the Y axis it would cause the hose to angle upwards and for the balls to continue to spawn in that upwards direction.

Impact: The player could not shoot down and the animation would look improper if the player ever moved his or her mouse below the fireman.

Solution: Implemented an check in the update for checking the mouse position. Created a true, false value that would show where the mouse is on the screen relative to the player. Next in the render and add bodies calls we would jus reverse the angle in the signature to show the correct angle.

Simply Harmonic Motion Calculating Water Height

Problem: The water height is the level that the water will be at and the ball is suppose to float on that level. Initially the water height was being calculated by just adding a certain integer to the grounds position to force to ball to  be above that line.
Impact: The ball would look like it is constantly bouncing and it does not look proper. The ball would fall normally in between levels but would mess up if past a certain y axis.
Solution: Change the water height to be the difference the ball is from the point i make as the water height. So that is calculating the displacement of the ball in the y axis from the point of origin(the water level).

Simply Harmonic Motion

Problem: The ball is suppose to be simulating floating in the water. But instead it would always fly off the screen. When calculating the force of the ball you are suppose to take into consideration both the force of buoyancy and the force of drag.

Impact: The simulation was failing because it was not correctly  showing SHM.

Solution: Changed it to make the densities slightly lower on the the ball that is suppose to be floating. And reversed the force of buoyancy so the ball would go up and down correctly.

Saturday, April 9, 2011

Box2d world

Problem: The balls when colliding  with cube would not push it far enough and the densities would not work properly the way we thought. We also had a problem where we though the speed would max out at around 5000.

Impact: The game did not work they way it was suppose to.

Solution: we had to scale down everything we were doing to work in the box2d world. Then when rendering it we scale it back up to the positions that we want.

Monday, April 4, 2011

Box2d Bodies

Problem:
There was too much lag when creating the balls that would represent the water. I would do this by creating a body in box2d and giving it the proper texture and fixture. I would then add the body to a body list. Even after they have been deleted with list.RemoveElementAt they would still cause the world to lag.

Impact:
The game would become unplayable after too many balls had been created.

Solution:
I had to delete bodies using the world.deleteBody command this will let you actually delete the body on the world instead of just removing it from the list. You also have to do this with anything else you create on the world like joints.