Hey guys,
so i have this task of moving a button to the bottom of the screen as soon as its clicked. i tired different solutions:
var button : Texture;
var x : int = 20;
var bottom : int = (Screen.height - 20);
var time : int = 2;
var startTime : int = Time.time;
var speed : int = 100;
function OnGUI() {
if (GUI.Button (Rect(10,x,80,40), button))
Debug.Log("Es geht los!");
// x += 150*Time.deltaTime; <<-- This way the button never stops to move
}
function Update() { <<-- this way the button stops at the middle of the screen (?)
if(Time.time > startTime + time) {
x += Time.deltaTime*speed;
if (x > bottom) {
x = bottom;
}
}
}
but none of them really worked.
i need the button to go to the bottom of the screen, and then move to the top and back like 5 times.
thanks in advance!