jeudi 1 mai 2014

Grab the current position of a moving ellipse in processing.js


Vote count:

0




I have an ellipse moving from left to right, I was wondering if there is anyway to store a specific point in that left to right path in a variable


e.g when the ellipse hits position X 100 pixels, store the specific path of position X of the ellipse.


I'd the ellipse must continue to run from left.


void draw() {



background(44,209,216);

fill(colourR,250,182);
noStroke();
ellipse(posX,posY,100,50);

posX = posX + speed;

if(posX == 100)
{
store posX in a variable
}


}


That is the sort of process I am looking for, the problem I am getting is that when I try to do something like newPosX = posX, they both continue to increment. How can I make it so newPosX stores the current position of posX and posX continues to increment. Also I mean that newPosX can NOT just = 100, i want to grab the position of posX when it hits 100 and store it in a variable. I know this is basic stuff but please help a noob out! THANKS!



asked 21 secs ago






Aucun commentaire:

Enregistrer un commentaire