We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Im kind of new to processing. I have an idea for a interactive piece of around 7 circles bouncing around the page which is what I have done so far. When my mouse goes to the top left of the screen I want the circle to go to a certain co-ordinate/place on the screen as the circles are going to make up an abstract form.. Is that possible to achieve? I'm just not sure how I would go about doing it.. I am assuming I would need to use MouseX, Mouse Y and functions and variables, perhaps?
Sorry! I have tried looking at a lot of tutorials and trying to wrap my head around this as it is for an Interactive assignment and I am new to Processing...
So help would be much appreciated! Thank you :)
Answers
yes, you use MouseX, Mouse Y
and if it's near the 0,0 you change the complete behaviour
and then a global var goToCoordinate tells you that the complete behaviour is different now
and in draw()
before setup()
I am doing something wrong, as I keep getting a error message saying expecting EOF, found 'if' and I did auto format it, trying to see it more clearly where the problem might be in my code..
I think I might have one too many curly brackets ... :|
with this code I only tried with one ellipse, instead of the seven that need to be in there...
here
closing bracket in line 25 was wrong
the dist is now 30, maybe too much
now only
if (goToCoordinate) {......................
is missing, see above
Am I meant to use
if (goToCoordinate) {......................
as part of a decision statement to make the ellipse go to the coordinate (400,400)... which is where I want the ellipse to go...? If so how exactly would I go about doing that?just calculate the distance between (400,400) and the ellipse using -
and then add it to the ellipse pos x,y
when you use *0,7 here, you got a damping
;-)
it's better when you try it and then post what you've got instead of just asking
but now I explained it in detail
;-)
`
I am using a class for the 7 balls I have bouncing around, will the balls still go to the coordinates I want them to go to if their in a class or will this be a problem?
Also how do I calculate the distance between 400,400 and the ellipses if its bouncing around the sketch? SORRY :( IT'S ALL VERY CONFUSING TO ME, NO MATTER HOW HARD I TRY TO UNDERSTAND IT. Sorry for all the questions, my teacher at uni doesn't really help -_-
So your help really means a lot to me.
your code doesn't run
this was outside a class or a function which is not allowed
that won't work:
you closed the class in line 87 but this belongs inside the class
you didn't hit CTRL+T inside the PDE for auto-format. So it's easier to spot wrong indentations
Do you want to move all balls to 400,400 when mouse is pressed? Then goToCoordinate belongs outside the class obviously
;-)
this is the start
the idea is that you have two kinds of behaviour for the circles.
normal: bouncing around
special: mouse in corner: they go to 400,400
Therefore:
your code must reflect that you have two kinds of behaviour
your code must let the circles do different things depending on the current kind of behaviour
your code must be able to switch between two kinds of behaviour
the var goToCoordinate tells you which kind of behaviour we use at the moment
Your tasks
The first kind of behaviour (bouncing) you have
The 2nd kind of behaviour (go to 400,400) you need
I told you how to do the second:
so it's
;-)
Ooooh! Thank you :)