- Home /
Question by
demonsight · Nov 11, 2013 at 07:54 PM ·
spawningmove an objectfunction updateendless loop
Endless runner, road segments spawn speed
Hi, I'm trying to make endless runner, character is still but ground is moving. So the problem is that ground is moving to fast and spawn speed to slow, I can't make it proportional.
function Update () {
var translation: float = Time.deltaTime * speed;
transform.Translate(-translation, 0, 0);
meters = spawnPoint.transform.position.x;
var increased:float = ((-1)*meters)- ((-1)*previousMeters);
if(myTimer > 0){
myTimer -=Time.deltaTime;
Debug.Log(myTimer);
}
if(myTimer <= 0){
lastPositionRegister(meters);
positionOfNextSegment2 = positionOfNextSegment2-increased;
myTimer = speed;
removeFirstFromList();
addLast();
destroyFirst();
spawnOnlyNew();
}
Any thoughts for making it proportional? myTimer - counts spawning delay time, o translation is for moving ground.
Comment
Your answer
Follow this Question
Related Questions
how to work my game 0 Answers
Stop a enemy by pointing a light at it. 4 Answers
Rubber banding camera (help!) 2 Answers
Move speed decrease stoping object problem. 1 Answer
random respawn and respawn delay 1 Answer