   return object
  float d = +2.0f, e = -10.0f,  f;....void myIdle(){.....e += 0.2;}Using the above code I have made an object move upwards. How do I make the object go back down the way it came up(i dont mean wrapping)? I have tried the following but doesnt work.if (e >= 10.0f) {   e = 10.0f;   e  -= 2.0;   }Can anyone help?   
  I usually have a bool to where it is going.  For example://Assuming this is C++bool up = true;if (up)    e += 0.2f;if (!up)    e -= 0.2f;if (e > MAXHEIGHT)    up = false;if (e < MAXHEIGHT)    up = true;I've seen people do it with velocities but for some reason I never got them...C++   ;  EDIT: The poster above just got in while I was writing, the same code thoughThe if statement block code won't work because e -= 2 will only happen when e>=10, which i guess isn't what you want it to do.For simplicity, you could do thisSet up a global bool called movingUp and set it to true.  Write a an if else to test to see your object is at the bottom or top of the screenif(e >= 10)  //at the top   movingUp = FALSEif(e <= 0)  //at the bottom   movingUp = TRUEThen write an if else to move your object such as:if(movingup)   e += 0.2;else   e -=2;   ;float e = 0.0f; // The bodyfloat velocity = 4f; // The speed of the body.//...void myIdle(){    // Move the body    e += velocity;    // Add resistance    velocity -= 0.1f;   // Bounce off the ground    if(e < 0f)   e *= -1f;}Implementing the bodies velocity will greatly make your life easier.  If you run the above example, you'll see that e is thrown up in the air, and then peaks and slowly comes back down, much like gravity would act on a flying ball.   