/* Shifts the background up and changes its sprite. */ private void shiftBackground(GameObject background, BackgroundScroller scroller) { scroller.nextBackground(); Vector3 pos = background.transform.position; // Need temp variable because you can't change position.y directly pos.y = (int)pos.y; // Drop any decimals it's picked up pos.y += 84; // Push it 2 screen heights up background.transform.position = pos; }
/* Shifts the background up and changes its sprite. */ private void shiftBackground (GameObject background, BackgroundScroller scroller) { scroller.nextBackground (); Vector3 pos = background.transform.position; // Need temp variable because you can't change position.y directly pos.y = (int)pos.y; // Drop any decimals it's picked up pos.y += 84; // Push it 2 screen heights up background.transform.position = pos; }