Wednesday, 6 April 2011

Playing With Fisics

This is the sketch that I did to find out weather my idea would work. The first sketch I did (not posted)I didn't use a physics library and the movement was odd and did not look natural. Also the code that I used gave to much control of the ball to the user. With the use of the physics library, fisica, the control factor was lessened by the fact that the arrow keys accelerate the ball. This means that the speed at which the ball goes is not set so that things that you expect to happen may not straight away as the ball still has some motion in the opposite direction.

One problem i had with implementing the arrow keys on the keyboard was that the ball variable was defined inside the setup method. This meant that the balls position could only be changed inside the setup method. To fix this the ball was defined outside of any method so that it could be manipulated by multiple methods.

Something I noticed only after uploading it to Open Processing is that the blocks and ball can be manipulated buy the mouse. this is unintended and I plan to change this for the note blocks but may leave it in for the ball as it gives it that extra bit of interactivity.

Finally the edges of the world can be seen on screen and when hit will change color as well. I don't like this and I believe there is a method some where in the library that allows me to make the edges appear off screen but still cause the ball to stay in the confines of the screen.



So far i think this project has been good as it has taught me about how to use libraries from outside Processing's own. It has been difficult but interesting going trough the Fisica documentation finding methods that do what I want to do and then trying to implement them. One such example is the contact method which is what I used to make the note blocks change color when the ball collides with them. The examples that came with the library helped me immensely with this.

Next I have to add sound to the sketch so that when the ball hits the different note blocks they make an individual sound.

No comments:

Post a Comment