but why in the beginning, the shape come from above and background are gray?
It is just an example for the usage of lerp() - which you had totally wrong. Do the background and initial position as you like. Position could be random starting position.
Since you have 10 shapes:
You need to bring this into arrays as well:
float pxshape=0, pyshape=0, // initial position
mxshape=random(-1, 1.21), myshape=random(-1, 1.072), // moving the shape (walking it)
txshape=170, tyshape=200, // target position
cxshape=0, cyshape=0; // current position when using lerp()
and can i ajust the rotation after de mousePressed?
yes, similar to the vars above for the position you can do the same with the angle.
Answers
post what you have
thanks! for now, just started with a moving 'quad' ... can be, right?
like this:
Well, it's obvious you need 10 shapes, positions and rotations for them all, so you can start there.
You need a class for your shapes (containing what?) and an array of these classes.
I can do this.
But you first
oh my god, I have to learn how to do this!
I am on a journey
You can solve it!
Each shape has a certain form, a start pos (random) and a target pos
it has also a way to go ("amt", see lerp)
So when mousePressed set a boolean var goToTarget to true
And look at lerp()
The two lines of specification don't say they need to move slowly into shape on mousePressed, just that they are randomly walking when it isn't...
i'ts something like that?
do you know object oriented programming? make a class myShape.
if not make an array of PShape and fill it with shapes
parallel make 4 parallel arrays to store the wrong random x,y coord and the correct ones (and 2 more arrays to store a movement vector x,y)
when mouse is pressed set a flag boolean usingRandomXY to false :
usingRandomXY=!usingRandomXY;
see an example below where you need to use class or more arraysin the example
usingRandomXY
is named isMoving (and it's the opposite)no, i don't know. is difficult to explain me...?
you don't have one exemple?
nice, thanks!
but why in the beginning, the shape come from above and background are gray?
and can i ajust the rotation after de mousePressed?
It is just an example for the usage of lerp() - which you had totally wrong. Do the background and initial position as you like. Position could be random starting position.
Since you have 10 shapes:
You need to bring this into arrays as well:
yes, similar to the vars above for the position you can do the same with the angle.
also, it's best to place each shape initially (internally) above the origin (0,0) in this line:
...or use a class / objects - see tutorials