Quantcast
Viewing all articles
Browse latest Browse all 91

multiple aninimations for one action

I've been working on a script that will play two animations for swinging a sword from left to right. I can't seem to get it working if tried two different ways to do this: this one has a basic idea of making the variables false and true when I left click on the mouse. var S1 = true; //swing one var S2 = false; //swing two function Update () { if (S1) { if(Input.GetMouseButtonDown(0)) { //animation.CrossFade("swing1"); S1 = false; S2 = true; } } if (S2) { if(Input.GetMouseButtonDown(0)) { //animation.CrossFade("swing2"); S1 = true; S2 = false; } } } This script I have not finished. I moved on to the script above this one because of all of the scripting errors and I was unable to come up with a way to define AddNumber (if it was even useful.) and i don't know the scripting errors it was giving me. private var swingnumber = 0; function Update () { var SwingNumber = swingnumber + AddNumber; if (SwingNumber = 0) { animation.CrossFade("swing1"); AddNumber = 1; } if (SwingNumber = 1) { animation.CrossFade("swing2"); AddNumber = 0; } Now the variables in the first script are not changing from true and false i have no scripting errors except i need an animation for it. I would be most thankful if their was another way to script this out if you guys have another way. I'm still new to scripting in general. but if not maybe you can fix my other scripts.

Viewing all articles
Browse latest Browse all 91

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>