Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

My IOS Game <:D

Discussion in 'General Discussion' started by Phat1212, Jun 9, 2014.

?

Is This System Any Guud?

Poll closed Jun 23, 2014.
  1. Yes

    0 vote(s)
    0.0%
  2. No

    1 vote(s)
    6.3%
  3. ChickenMcFlurry

    15 vote(s)
    93.8%
  1. Phat1212

    Phat1212

    Joined:
    Sep 17, 2013
    Posts:
    6
    Alrighty! So I've been making an IOS/Android game for a couple days, and i have a crap ton of questions as I've never developed for this platform before, i know that this should probably be on the questions part of the forum but i'm not so desperate and i'm really talking about my game...SO, my game, err..If you have ever seen Temple Run, its pretty much that, except i'm giving the player the choice of going Free run mode, where i have randomly generated terrains, or campaign mode, where the terrains are spawned in with a script, not random. So here are my scripts, i'm spawning the terrains in with a script as i feel it would be faster and more efficient, i may be wrong, but here is the script that spawns them in randomly:

    Code (JavaScript):
    1. #pragma strict
    2.  
    3. var LoadedTerrain : GameObject[];
    4.  
    5. function Start()
    6. {
    7.    
    8.     Instantiate(LoadedTerrain[Random.Range(0,4)], transform.position, transform.rotation);
    9.    
    10. }
    Basically, i have a row of empty game objects that are in a line, with 200m spacing from each other, as my terrains are 200x200(I didn't make just one long terrain eg 200x2000 because it stretches the crap out of the textures) and what the script does, is randomly chooses between an array of terrains, and plops the one selected down...Pretty Simple.

    And with the campaign mode, the levels will have fixed terrains, i place them via script..because..well...i dont know.

    Code (JavaScript):
    1. #pragma strict
    2.  
    3. var LoadedTerrain : GameObject;
    4.  
    5. function Start()
    6. {
    7.  
    8.     Instantiate(LoadedTerrain, transform.position, transform.rotation);
    9.  
    10. }
    Vhalla! Its S*** i kno, but really what i'm trying to accomplish is a random set of terrains that are loaded each time you play the level, i name the terrains Jungle_1, Jungle_2 ect ect, because i'm thinking toward the end, i can make a multitude of terrains, eg, a set of desert terrains, or highway ones. As you can see on the image below, this is not just one terrain, this is about 6, all 200x200 is size, and generated through script. Is this a good system, am i wasting my time? I don't know. And i don't care, i'm having a helluva fun time doing it! Cheers for taking the time to look at this post!

    Daniel Cottingham
    Founder, Lead programmer of Endorphic Games
    PS:Bhad Puncktuation and gRammer sozzy, I Whas Rushing ;)
    Unity 2014-06-09 13-22-47-53.png Unity 2014-06-09 13-22-47-53.png
     
  2. TylerPerry

    TylerPerry

    Joined:
    May 29, 2011
    Posts:
    5,577
    Instantiate is slow, its faster just to add them in the editor.
     
  3. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,716
    Yep, object pooling is your friend.
     
  4. Phat1212

    Phat1212

    Joined:
    Sep 17, 2013
    Posts:
    6
    Thanks For The Answer!, Preciate' it
     
  5. zDemonhunter99

    zDemonhunter99

    Joined:
    Apr 23, 2014
    Posts:
    478
    Everyone voted for ChickenMcFlurry, hahahaha.
     
  6. TylerPerry

    TylerPerry

    Joined:
    May 29, 2011
    Posts:
    5,577
    I can't believe out of everyone I was the one to vote properly and answer their question.
     
    IcyPeak likes this.
  7. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    Id buy that for a dollar