having a bit of difficulty with my code and very new to this so any help would be much appreciated.
Lets say I had a circle object which I could view in a shapes window, and I need it to move different ways, one step at a time, depending on the argument.
For example, lets say the circle had a Start position which was 0 (based on x pos) & the furtherst it could go is 15 - Furthest.
If the circle is at Furthest (position 15), it needs to move left back to Start (position 0) one step at a time.
Otherwise, it should move to Furthest (if its position is > 0, most likely to the right)
I am working with a few classes and within another class I can use methods right() and left() which are set to move the circle to the right or left by 1. I also have another method I can use called getPosition() to show where the circle currently is.
My if statement is as follows:
if(circle.getPosition() == Furthest)
// then a while/ for loop here - to move the circle LEFT back so Start (which is 0) one step at a
time
OTHERWISE
Circle should move to Furthest if the position is currently not furthest
Hopefully I have gave enough info, it's just the loop I'm having trouble with. I can provide any more code if needed but even just an example as to how to move an object using similar methods would be fab.
Thanks so much