Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - asweare

Pages: [1]
1
Support / player control
« on: May 23, 2013, 02:05:41 pm »
I have question about my script,

I was managed to made the character move horizontally, but
it doens't work with animation.

whenever i press left or right,

character animation stop moving.

this is my script

also, how can i make the character idle when i am not pressing the button??


(i am not really a programmer, very new to the program, so if you guys can help me out it will be really great)

   void Update() { 
        movement = Input.GetAxis("Horizontal") * moveSpeed; 
        movement *= Time.deltaTime; 
        transform.Translate(movement,0.0f, 0.0f); // move player along X axis 
         
        // move right 
        if(movement > 0.02f)
        {
            anim.Play("walk");
            anim.animationCompleteDelegate = null;
            walking = true;
        }
     
        // move left 
        if(movement < -0.02f)
        {
            anim.Play("walk");
            anim.animationCompleteDelegate = null;
            walking = true;
        }

Pages: [1]