Coding / Session 5
October 30, 2013 § Leave a comment
[Add and watch video on UniLearn when it’s added, noting down what certain code does]
“The challenge is to make the second point move in the same way as the first to draw more complex shapes…”
Unfortunately I was unable to make it to this session as I had a medical appointment, I did however still attempt this, and got by rather well, the annotated code below explains it.
// The above two lines of code allows for me to create a speed on the x and y axis for the second point. Where the code sets a random position for the second point, we can add values to the new variables below this so that it moves as shown below:
// Below (4 lines) – set random position for the first point
// Set a random position for the second point
//set a fixed speed for the second point
// The above 8 lines of code are the parameters of which the line can bounce within, if I alter one of these the line will become stray and won’t give the desired effect
Altering the figures in red determines the speed of the line at different angles, I played around with these numbers to gain these results (with the numbers next to them). I wish I could see all the number combinations and their results!
The original (with above numbers):
-51; / 55; / -38; / 75; / -36; / 23; / -89; / 67;
-20; / 20; / -20; / 20; / -20; / 20; / -20; / 20;
-5; / 5; / -50; / 50; / -5; / 5; / -50; / 50;