- Home /
Make an enemy appear and then disappear at random?
I am making a scary game and want to make the enemy appear in front of the player then disappear a couple seconds after. Can anyone please help? I just started to make games so i am a scripting noob. Help would be greatly appreciated!
Answer by derrtyones · Sep 18, 2012 at 11:09 PM
I am working on a scary game as well. I placed a box with a box collider and it functions as a trigger. Once the player hits the trigger (Search: ontriggerenter) you can unhide the enemy. With "yield WaitForSeconds(3)" it disappears after 3 seconds.
Thanks for the reply! That may work, but is there a way to do it without a trigger, say if i am just wandering around and then the enemy just appears at complete random?
Yes, I think you can use "transform.position" and need to set the target as the player.