15.08.2012, 02:21
hello
how can i make a object moving up and down randomly without anyones interference.?
how can i make a object moving up and down randomly without anyones interference.?
CreateObject(3865, -2712.88, 583.54, 16.30, 0.00, 0.00, 270.01); //down CreateObject(3865, -2712.88, 583.54, 34.95, 0.00, 0.00, 270.01);//up |
//At top
new pipe;//To store Object ID
new loc; // To store current location of object
public OnGameModeInit()
{
//And all your codes...
loc = 0; //Currently it is down
pipe = CreateObject(3865, -2712.88, 583.54, 16.30, 0.00, 0.00, 270.01); //down
new time = MoveObject(pipe,-2712.88, 583.54, 34.95,2); //Will move it up
SetTimer("MovePipe",time,true);//time is time it takes to go up/down
return 1;
}
forward MovePipe();
public MovePipe()
{
switch(loc)
{
case 0:
{
MoveObject(pipe, -2712.88, 583.54, 16.30,2);
loc = 1;
}
case 1:
{ MoveObject(pipe,-2712.88, 583.54, 34.95,2);
loc = 0;
}
}
return 1;
}
//To make it move up/down
SetTimer("MovePipe",time + 5000,true);