How could I make an object (a cloud) increase its speed every time it changed directions? I want to make the cloud in the pengu program move faster each time it reaches a cliff and turns around. Thanks!
You could just use an 'int' instance field for the speed of the cloud and increment it when changing directions. However, it will not take long for the cloud to move at incredible speeds. Tracking the x-coordinate of the clouds in an instance field of type 'double' can help allow more back-and-forths before they reach those outrageous speeds. However, just doing the first does get the job done (if you can deal with the long-term behavior imposed). Placing a maximum limit to the speed might be a viable option.
If you still have issues, post the code that you are trying to use so we can give pointers on the coding itself.