- Home /
qrest system
i am makeing a 2d sidescrolling offies sim for fbla but i wont to put in a qrest system like you talk to some one then you go to a computer and pres e and it wold then take you to the next level or unlock the next npc qrest to do how wold i do that ples help
ps i have dislexsya
HI,Thats quite simple(but you ned to know about Send$$anonymous$$essage and delegates(optional))
All i would do is
Check for trigger with the npc(person you would talk to) using OnTriggerEnter
(Check docs for further info)
and then in the script (player script with some thing like canload = true) i would update it
and then check for trigger once agian to see if player is near door
then when you press E
load the lvel using
if(Input.Get$$anonymous$$ey($$anonymous$$eyCode.E))
{
Application.LoadLevel("Your level name");
}
Soory i could write the script as its too late and i nned to get back to bed
Do not use ontriggerenter, it is bugged(for me atleast), and hogs up colliders/performace, use vector3.distance.
Not to thread hijack, but... OnTriggerEnter is not bugged and is fine to use; calculating unecessary distance checks every frame if it's put in Update() sounds like bad advice. If you have a Profiler output that shows otherwise, I would like to see it.
Hi, @HuskyPanda213
Never use Vector3.Distance it uses much more memmory as it has to calculate SuqareRoot
So i would rather suggest using
(Position2 - Position1).sqr$$anonymous$$agnitude
Even better is using OnTrigger Function which is optimized as all calculation are done by NvidiaPhysx Engine in an another thread
Answer by cakegamer · Jan 17, 2014 at 03:45 PM
but i wont it wer i pres e on a object like a computer and then it unlock the npc so you can speek to them and get teliported to next level how wold i do that?
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
2d sidescroler offies sim qrest system for fbla 0 Answers
How To Make GUI Buttons Load/Quit 1 Answer
hide child object script - help 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers