- Home /
Mouse move to control the animation
Hello! I do not know much English, so I'm sorry for the mistakes: D I'm doing a 2D platformer in which you control your character with the mouse. I need to move in the Y-axis to less than "a" up to play its one animation down - another, when you stop to play its third, and moving on more than "a" to play its fourth. Please help me write a script! I would be very grateful :) Here's the script:
using UnityEngine; using System.Collections;
public class MouseControl : MonoBehaviour {
 void Start () {}
 public float speed=0.1f;
 Vector3 MousePos=Vector3.zero;
 void Update () {
 MousePos = new Vector3(speed, Input.GetAxis("Mouse Y"), 0);
 transform.position+=MousePos;
 }
}
I'm not sure what you are asking. In particular this sentence does not make sense to me: "I need to move in the Y-axis to a to play its fourth." What do you want to happen that is different than this code? If you are struggling with English, you might include a drawing or a screen shot.
Answer by RetepTrun · Feb 19, 2013 at 06:38 PM
A very general question.
I recommend doing tutorials that have animation in them, like the lerpz 2d tutorial in the asset store.
Also there is useful code in this script http://answers.unity3d.com/questions/10240/effective-way-to-toggle-character-animations.html
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                