Hi,
I am working on a small puzzle game and I am quite new to programming, I wanted to have an object which moves continuesly up and down.
So I created an object added a script with the following information:
var objectSpeed: int;
function Update () {
amtToMove = objectSpeed * Time.deltaTime;
transform.Translate(Vector3.down * amtToMove);
if(transform.position.y <= -3.4){
transform.Translate(Vector3.up * amtToMove);
}
}
What happens now is that the object is moving down till it reaches -3.4 and then stopps, i guess this happens because it moves up and down at the same time. So my question is how do I stop the down movement and get it to move upwards and then down again and so on ?
Thanks in advance