Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2015
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. void CreateObstacle(){
  2. // generating random upper pipe position
  3. float randomPos = 4f-(4f-0.8f-pipeHole)*Random.value;
  4. // adding upper pipe to stage
  5. GameObject upperPipe = (GameObject)Instantiate(pipeObject);
  6. // setting upper pipe position
  7. upperPipe.transform.position = new Vector2(4f,randomPos);
  8. // adding lower pipe to stage
  9. GameObject lowerPipe = (GameObject)Instantiate(pipeObject);
  10. // setting lower pipe position
  11. lowerPipe.transform.position = new Vector2(4f,randomPos-pipeHole-4.8f);
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement