- Home /
Slender death and look sound script
Hi, I am making a game like Slender and i really need help! I have the script to make it so that the slenderman is following me, but I really need help making it play a sound when the player can see him and when staring at him noise appears on your screen and when its really intense it opens a new scene. Please help.
By the way, heres my follow script.
var target : Transform; //the enemy's target var moveSpeed = 3; //move speed var stopSpeed = 0; var rotationSpeed = 3; //speed of turning
var myTransform : Transform; //current transform data of this enemy
function Awake() { myTransform = transform; //cache transform data for easy access/preformance }
function Start() { target = GameObject.FindWithTag("Player").transform; //target the player
}
function Update () {
var Speed = moveSpeed;
if (renderer.isVisible)
{
myTransform.position += myTransform.forward * stopSpeed * Time.deltaTime;
}
if(!renderer.isVisible)
{
myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
}
//rotate to look at the player
myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);
}
I'm confused with the MyTransform because no matter what he doesnt follow he keeps getting closer but if I move he keeps going where I was not where i am. Please help
Thankyou.
Why are so many people trying to clone Slender now? Before, it was $$anonymous$$inecraft...
You may want to check my answer and comments here : http://answers.unity3d.com/questions/321749/how-do-you-pick-up-pages-like-in-slender.html
"Back in my day" it was Asteroids, Pong, or Breakout. Nowadays it seems to be whatever one of the 'Big Names' on Youtube plays. Slender and $$anonymous$$inecraft -look- simple, so they're easy targets.
http://answers.unity3d.com/questions/321749/how-do-you-pick-up-pages-like-in-slender.html
Slender Guide Version 2
While I have finished writing the code, I don't have time to write a full guide explaining the steps taken and what I have coded in. I am changing the code in the below guide so people can still make their own rather than just using my package, and I really hope people write their own ins$$anonymous$$d of just using my package.
Slender Guide Version 2 (I can only upload 5$$anonymous$$B, so the project is very basic, but working!) : http://www.alucardj.net16.net/unityanswers/SlenderGuideV2-scene0.unitypackage
Fixed problems from Version 1 :
picking up papers in the editor - there were some issues with using LockCursor while running in the editor, hopefully these have been compensated for, recommend use the E key to pick up papers while running in the editor (but mouse still works). some movement issues - I had no problem, but it was brought up so I have tweaked the movement script.
New features :
The more papers picked up, the $$anonymous$$an follows closer. Audio : when picking up paper, when the $$anonymous$$an is first sighted, running and walking footsteps with adjustable audio gap between steps. Custom mesh with fading alpha fullscreen static effect.
And don't forget the awesome original flickering flashlight!
Here is the video link for the obstacle avoidance raycast : http://vimeo.com/9304844
Comments and feedback are welcome, as long as you have something more to say than just it doesn't work. The package proves it does. And please don't ask new questions, post comments here. If this keeps going or more people have requests, I might have to start a Unity Forum page.
Enjoy =]
Your answer
Follow this Question
Related Questions
Noise cancelling 0 Answers
Camera rotation around player while following. 6 Answers
Audio Noise Removal 0 Answers
sound (audio) makes noise only in timeline 2 Answers
Audio doesn't work in editor? 6 Answers