Search Unity

Designing a Lock and Key Mechanism for Levels

Discussion in 'Scripting' started by aditya_tirodkar, Sep 15, 2012.

  1. aditya_tirodkar

    aditya_tirodkar

    Joined:
    Sep 12, 2012
    Posts:
    7
    Hi,

    My current problem is this, I have to create 3 enemies or 2 enemies and a collectible card. Now, I need a script for a level load or atleast the pseudocode which can direct me as to how I can make the loadlevel in such a way that all the three enemies have to be killed or that 2 enemies are killed and the collectible card is obtained. Something like:

    if(Enemy1==Destroyed Enemy2==destroyed CardCollected==true)
    then
    {Destroy Door and levelload(1);
    }

    Please help me out, I need this for a class project and I am just beginning work in Unity.
     
  2. StoneFish

    StoneFish

    Joined:
    Aug 26, 2012
    Posts:
    123
    I think you need to read up on basic scripting tutorials.....

    What you're asking is very basic.
     
  3. softwizz

    softwizz

    Joined:
    Mar 12, 2011
    Posts:
    793
    you could use booleans

    When enemy 1 is destroyed set a bool to true, the same for the other enemy(s) and card then use the if statement to check if all bools are true.