Search Unity

Help with doors

Discussion in 'Scripting' started by JBGamemaker, Aug 4, 2019.

  1. JBGamemaker

    JBGamemaker

    Joined:
    Dec 9, 2018
    Posts:
    50
    I dont know if this is the right place to post this but here goes nothing.

    Im making a Call Of Duty: n@#! (Not sure if i can use that word) zombies game themed around the upcoming area 51 raid, an alternate timeline IF somewhere AROUND 300k people actually showed up and where only 4 gaurds (the rest assumed only 4 people would show up and decided it a better use of their time to spend it with friends and family) use tranquilizer pellets fired from Airsoft guns to fend of the Weebs. Now onto my problem

    im mostly get my resources from a tutorial series made by BigRookDigital But something he didnt cover in that series is how to make doors leading to other areas

    so can someone tell me what stuff id have to learn to make doors to other areas, as in paying the price - the amount it costs being reducted from your score and it opening?
     
  2. csofranz

    csofranz

    Joined:
    Apr 29, 2017
    Posts:
    1,556
    You Need to separate the visuals (a door, window, portal, teleporter, hole in the ground, cave entrance, yougettheidea) from the game mechanics. If you want to the player to get from one place to another under certain conditions, you'll usually use a small script that is attached to a collider. So when the player steps into the collider (set up as a Trigger), the script executes. What this script does is up to you. It could load a new Scene (see Scene Manager), or simply 'teleport' the player to a new portion of the Scene by altering the player's transform.Position.

    I suggest you read up on Colliders and Triggers, which will take roughtly 10 minutes and will give you millions of great ideas to try out.