I have started writing my code and it is going ok.
Once i started the code i decided to change the colours of my cirlces, instead of using red, blue and yellow(RBY) like painting colours it was recommended that i use red, green and blue (RGB) as these are the computer colours. When they mix they still form new colours but slightly different from the RBY thought what was better was that when all three coloyur mix the turn white.
I have needed to make a lot of varialbles (int) for each circles center points on the X and Y axis. I can use them to tell the computer when a circle is touching another. Once i have made these i created the circles which turned out perfect the first try. From here i then started to code the MousePress which was to make them interactive. I created a code which said; when the mouse is click over the diameter of a circle you can drag it. During this i came across a few problems. These are the problems and thier solutions:
1. The circles moved directly to the point the mouse was. This was because i told the circles X and Y points (centre) to move to the X and Y point of the mouse. I changed the code by saying when you click the area of the circle it moves to the mouse - the area in the diameter the mouse is
2. The circles pushed each other away once they touched. This wasn't really a problem once i fixed the code above.
3. When the circles got to close they sucked each other in and one disapeared and you could not retrieve it again. I fixed this by saying if the circles centre points get to a certain point near another they stop.
4. The circles disapeared when they went of the edge of the screen. I didnt find a soloution for this but am thinking of adding a reset button to fix this.
No comments:
Post a Comment