I have an object and with every tick i make it move forward by 1 pixel. Once it reaches a certain point i would like to make it move back by 1 pixel and again forward. How would i do this?
Develop games in your browser. Powerful, performant & highly capable.
Check out the how do I FAQ containing links to topics that might help you with this. (check out the questions about moving objects).
Also make sure to read the tutorial about framerate independence to take the good habits the sooner as possible <img src="smileys/smiley1.gif" border="0" align="middle">.
Thanks, found my answer