Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Infinite Level Proccessing in Blocks

Discussion in 'Scripting' started by AnthonySturdy, May 28, 2015.

  1. AnthonySturdy

    AnthonySturdy

    Joined:
    Feb 24, 2014
    Posts:
    55
    Hi, I want to make a 2D mobile game where it's constantly scrolling, and you have to dodge certain things (I know it's unoriginal, I just want to make it). I had the idea to have the background scrolling rather that the player.
    My problem is the generation of the background. I'm trying to Spawn/Instantiate the prefab (Random number, then it picks based off of that) and the background is moving as soon as it's spawned. Once the background moves off of the screen it's destroyed and a new one is Instantiated.
    I would greatly appreciate it if someone could point me in the right direction and help with this :D
    Thanks, Anthony.
     
  2. DarknessFlame101

    DarknessFlame101

    Joined:
    May 28, 2015
    Posts:
    2
    You should take a look at the Space Shooter Tutorial videos -> https://unity3d.com/learn/tutorials/projects/space-shooter

    It basically spawns (instantiates) asteroids off the screen at the top, moves them down during gameplay so the player has to avoid them, and when they leave the play area they are destroyed if not destroyed by the player.

    It accomplishes this using a Collider that represents the entire game area, and when the asteroids leave the play area ( the collider) they are destroyed. they accomplish it using the function OnColliderExit() to determine when the asteroid leaves the play area and then destroys the object once it detects that.

    So if you go through that tutorial series im sure you will learn a lot about what you need to make this happen
     
  3. AnthonySturdy

    AnthonySturdy

    Joined:
    Feb 24, 2014
    Posts:
    55
    Sounds great, thanks :D