How To Create Horror Game Complicated Puzzle In unity C#?

As mentioned in the post below I make such puzzles, Like Poppy Playtime Puzzle.

4 Answers

4

Hello mate,

Your post is very confusing, what do you want to achieve? are you trying to make a key/door system? or do you want to learn how to make a copy of Poppy Playtime? could you elaborate and list what you are trying to do please

Simple Meaning I want to make it so that when pick up the player object
Drop it to its actual location and open a new door.

Poppy Playtime can be taken as an example.

In Unity 3D

Hello mate,

It’s pretty simple, you can use a boolean on a script attached to the player:

public bool hasKey;

And when the player collides with the key you change the boolean to true:

private void OnCollisionEnter(Collision other) {
   if (other.CompareTag("Key") == true) { // the key has the tag Key (case sensitive)
      this.hasKey = true;
      other.gameObject.SetActive(false);
   }
}

And finally when triggering the door you check the boolean:

private void OnTriggerEnter(Collider other) {
   if (other.CompareTag("Door") == true) {
      if (this.hasKey == true) {
         this.hasKey = false;
         other.gameObject.SetActive(false);
      }
   }
}

thank you but, where attach Script? Means the door and key script are different.

No I made it so you can put all of these in the script attached to the player, you just need to add a trigger around the door and a collider on the key

Can you explain by video ?

Sure but there is really not much to it, you make a gameObject for the player, the key and the door, you attach a script to your player for movement and key system and you attach colliders and rigidbodies where you need

Hello again @unity_C021CCFB576C9421E9FD,

Here is a video:

I used one of my games because I didn’t want to make the player movement

Thank you Friend