Hi my name is Dino. My game is about ball jumping and moves to right and should not tag objects. Objects are constantly moving. So what I want to do… I want my object moving only when there are inside of camera or other idea is I copy few time object moving script and put it inside object for certain instances. So when my player tag collider my object moving script start work (first script), and then when my player tag some other collider (second script) my object moving script stop work. So how I can stop and start script? I don’t have Idea how to do this. Please help. Thanks a lot
#pragmastrict
privatevarXpos : float;
privatevarYpos : float;
privatevarmax : boolean;
varVert : boolean;
varmaxAmount : float;
varstep : float;
functionStart () {
Xpos = transform.position.x;
Ypos = transform.position.y;
}
functionUpdate () {
//SETTHEMAX
if(Vert){ //Vertical
if(transform.position.y >= Ypos + maxAmount){
max = true;
}
elseif(transform.position.y <= Ypos){
max = false;
}
}
else {
if(transform.position.x >= Xpos + maxAmount){
max = true;
}
elseif(transform.position.x <= Xpos){
max=false;
}
}
//MOVINGTHEPLATFORM
if(Vert){ //Verticalmovement
if(!max){
transform.position.y += step;
}
else {
transform.position.y -= step;
}
}
else { //Horizontalmovement
if(!max){
transform.position.x += step;
}
else {
transform.position.x -= step;
}
}
}
1817286–116284–objectmoving.js (891 Bytes)