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.
Sunday, April 10, 2011
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).
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.
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.
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.
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.
Friday, March 25, 2011
2D Animation
Problem:
When the KeyListener picks up an command it should move the player and change the picture that will be displayed to make it look like an animation of walking. The picture was looping to fast and the animation looked silly.
Impact:
The animation will not look proper and will take away from the look of the game.
Solution
I have to use game time and pass that in as a parameter to my new Draw method in the Player class. Game time is the total time in seconds that the user has been playing the game. The player class checks this time against the time interval that you want the picture to change at i suggest 0.15. Once this is set up in an If statement you can increment the frames in the animation in it returns true.
When the KeyListener picks up an command it should move the player and change the picture that will be displayed to make it look like an animation of walking. The picture was looping to fast and the animation looked silly.
Impact:
The animation will not look proper and will take away from the look of the game.
Solution
I have to use game time and pass that in as a parameter to my new Draw method in the Player class. Game time is the total time in seconds that the user has been playing the game. The player class checks this time against the time interval that you want the picture to change at i suggest 0.15. Once this is set up in an If statement you can increment the frames in the animation in it returns true.
Wednesday, February 23, 2011
Networking and UDP servers
While i was doing a project for a networking class of mine i was asked to create a UDP server what would emulate a number guessing game between the client and the server. The client will send its guess to the server and it will determine if it is correct and respond accordingly.
To set up a server you must fist initialize, create, and bind the socket that you will use to pass information. I thought that the binding would also take place in the client but i does it not. As a result of my mistake i would receive the data that i gave the server instead of the correct response. For example when i would concatenate my message and send it to my server my input and output would end up looking some like this GET /NumberGuessing/n=2.
After careful study i noticed that i shouldn't have had the bind on the client side and after that the server started to respond to the messages i would send it.
To set up a server you must fist initialize, create, and bind the socket that you will use to pass information. I thought that the binding would also take place in the client but i does it not. As a result of my mistake i would receive the data that i gave the server instead of the correct response. For example when i would concatenate my message and send it to my server my input and output would end up looking some like this GET /NumberGuessing/n=2.
After careful study i noticed that i shouldn't have had the bind on the client side and after that the server started to respond to the messages i would send it.
Subscribe to:
Comments (Atom)