- Home /
Basic Scripting help
I have looked at the beginner guides to scripting here already so don't tell me to do that. I don't know how to script at all. I need a script that makes an animation play when a player crosses a line, then creates something. Can someone give me an easy step by step guide to this?
Answer by Chris D · Jun 27, 2011 at 05:12 PM
I'm...still going to suggest finding a good tutorial. Until you understand what the code you're copy/pasting does, you're just going to be back here every time you need to write a new function.
Do you understand how the triggers from your older question (here) work? If so, you're going to use the same triggering portion, but will need to use the Animation.Play() function for your animation and then Instantiate() to create your object.
Please don't forget to go back and accept the answers to your old questions (and this one) if they successfully solve your issues. Also, please don't post multiple questions about the same thing (I closed the other one) - if you notice that you've created multiples by accident, just go back and close them yourself (it's an option under the tag area).
Answer by BlueMoonGames · Jun 27, 2011 at 05:03 PM
Attach a box collider to the line then set it to "is Trigger". Write a script that plays the animation when the player collides with the line (Collider:OnCollision Enter, etc) and attach that script to the line. You could use the instantiate command to clone an object and recreate it wherever you want. You can find out more about colliders and how to use them here.