If the code changes the position of the shape too often, the speed will be high.
How often does the position change?
For example if in the beginning the position was changed every 1 second and...
Type: Posts; User: Norm
If the code changes the position of the shape too often, the speed will be high.
How often does the position change?
For example if in the beginning the position was changed every 1 second and...
Did you look at times when the changes in obstacleX happens? Is it change more frequently to make it move faster?
For testing change the width/distance the shape moves to 100 from 600 so the...
Ok. Why does the code subtract 0.1 when the change is always 1?
Now what about the times when the changes are made?
For example if a shape's position is changed by 10 units every 10 seconds...
Please post the print out for the values of obstacleX.
You skipped this question:
What about the time between moves? Does the time decrease?
If the distance between positions changes at a constant rate,
Then what about the time between moves?
See the formula in post#6
The formula for speed = distance / time
The speed will increase if the distance goes up and/or the time goes down
Which of those two values are changing?
I have no idea what that means. Do...
What did the print outs show?
Try debugging the code by adding some println() statements to print out changes to the variables that control the speed of the rectangle. The print out should show you where the code is going wrong....