Friday 9 September 2011

Reflections. Part 1. Code

Reflections

Trying to achieve in code what I envisioned for this project was an exercise in frustration. I knew theoretically how the different parts fit together and how they might be done in algorithm, but constantly found unexpected behaviour along the way. Issues included trying to get things to be relative  to the centre of the screen while still taking account of mouse control and small code changes unintentionally altering other elements. With time I know that I can overcome these issues.

For now I learnt much about coding such as the power of arrays, creating objects through functions and improved control of variables. I also found the comments and clarity of my code was vastly improved.

Finally I would like to take you through the code changes between the last precedent and the final design. Depending on which corner the of the screen the mouse is in, the colour shifts. This is achieved   by using an if statement that tells the colours to change differently depending on which quarter of the screen the mouse is in. E.g. mouseX > width/2 and mouseY>height/2. To make the colour change evenly width/2 and height/2 were turned into a percentage and then that percentage was applied to the colour.



No comments:

Post a Comment