Baoxiong Dai -DSDN 142
Thursday, 26 May 2011
Words
at first i didnt know what to write for my word thing, so i started just talking about the variable, then i had a look at the breif and found out that i was mean to be talking about my project.
Playing with the code
i got my program working, the colour balls are changing the colour of the particles and the spin is making it spin. so i played with the code and made a new ball and i add right and left spin code together and found somthing really cool. normally the spin balls make the particles spin out, but when i add them together they particles is absorbing into the mouse i found that really cool.
right ball
vx -= (150 - radius) * 0.01 * cos(angle - (0.7 + 0.0005 * (150 - radius)));
vy -= (150 - radius) * 0.01 * sin(angle - (0.7 + 0.0005 * (150 - radius)));
left ball
vx -= (150 - radius) * 0.01 * cos(angle + (0.7 + 0.0005 * (150 - radius)));
vy -= (150 - radius) * 0.01 * sin(angle + (0.7 + 0.0005 * (150 - radius)));
Absorb ball
vx -= (150 - radius) * 0.01 * cos(angle + (0.7 + 0.0005 * (150 - radius)));
vy -= (150 - radius) * 0.01 * sin(angle + (0.7 + 0.0005 * (150 - radius)));
vx -= (150 - radius) * 0.01 * cos(angle - (0.7 + 0.0005 * (150 - radius)));
vy -= (150 - radius) * 0.01 * sin(angle - (0.7 + 0.0005 * (150 - radius)));
right ball
vx -= (150 - radius) * 0.01 * cos(angle - (0.7 + 0.0005 * (150 - radius)));
vy -= (150 - radius) * 0.01 * sin(angle - (0.7 + 0.0005 * (150 - radius)));
left ball
vx -= (150 - radius) * 0.01 * cos(angle + (0.7 + 0.0005 * (150 - radius)));
vy -= (150 - radius) * 0.01 * sin(angle + (0.7 + 0.0005 * (150 - radius)));
Absorb ball
vx -= (150 - radius) * 0.01 * cos(angle + (0.7 + 0.0005 * (150 - radius)));
vy -= (150 - radius) * 0.01 * sin(angle + (0.7 + 0.0005 * (150 - radius)));
vx -= (150 - radius) * 0.01 * cos(angle - (0.7 + 0.0005 * (150 - radius)));
vy -= (150 - radius) * 0.01 * sin(angle - (0.7 + 0.0005 * (150 - radius)));
overlapping
when the balls bounce back the all land in the same spot, so if the user wanted to find a ball they will have to move 5 balls to get to the one they want.
locked.vy = random(-30,30);
locked.vx= random(-30,30);
i added random(-5,5); to the how speed and direction they bounced out, which didnt work, well it worked but it only changed the spot they overlapped, so i added a float for the speed and direction and then added the random outside of that code:
float ranx = random(-30,30);
float rany = random(10,80);
if ( mouseX > 160 && mouseX < 240 && mouseY > 350 - Ball.radius) {
if (locked != null && locked != clicked) {
locked.vy = -rany;
locked.vx = ranx; }
locked = clicked;
locked.x = 200;
locked.y = 350;
locked.vx = 0;
locked.vy = 0;
locked.bounded = false;
} else if (clicked == locked) {
locked = null;
}
}
locked.vy = random(-30,30);
locked.vx= random(-30,30);
i added random(-5,5); to the how speed and direction they bounced out, which didnt work, well it worked but it only changed the spot they overlapped, so i added a float for the speed and direction and then added the random outside of that code:
float ranx = random(-30,30);
float rany = random(10,80);
if ( mouseX > 160 && mouseX < 240 && mouseY > 350 - Ball.radius) {
if (locked != null && locked != clicked) {
locked.vy = -rany;
locked.vx = ranx; }
locked = clicked;
locked.x = 200;
locked.y = 350;
locked.vx = 0;
locked.vy = 0;
locked.bounded = false;
} else if (clicked == locked) {
locked = null;
}
}
Balls
I wasn't sure how to create the balls which have to be bounded and it have to be able to snap into the slot. tim helped me create the ball and how to lock the ball into the slot as well.
Colour
the colour setting was at "colorMode(RGB, 2);" thats why i could only get black and white i change it to "colorMode(RGB, 255);" which gave me more colours.
Started playing with the particles
i started playing with the particles. i changed the codes around so i can get the particles spining right and left, and i played with the colours at this point i can only get it to be white and black.
Subscribe to:
Posts (Atom)