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.


Messages - nicntj

Pages: [1]
1
Support / Re: Walking Animation Then Idle Problems
« on: May 26, 2013, 07:14:08 pm »
This is really helpful thanks a lot!

But I had an idea once it started working. What I would like it to do is lets say your walking on the right side then stop the idle image needs to be facing the right. Then if your walking left when you stop the idle image needs to be facing left. I have a leftIdle and a rightIdle animation how do I program it in. Is it just another else if or else conditional statement?

Thanks a ton!

2
Support / Walking Animation Then Idle Problems
« on: May 26, 2013, 04:13:35 pm »
I have the C# code that makes the Animation move (from scripting an animated sprite in the documentation). And I did some modifications to it so when I walk left (a-key) the animation will play and when you take your finger of the key it will go to idle. But I can't get the same thing to happen when I'm walking right (d-key). My right animation doesn't even play it stays at idle. I haven't found much on this so thanks for your time and help.

here is my code:
Code: [Select]

public class TutorialAnimController : MonoBehaviour {

    // Link to the animated sprite
    private tk2dAnimatedSprite anim;

    // State variable to see if the character is walking.
    private bool walking = false;

    // Use this for initialization
    void Start () {
        // This script must be attached to the sprite to work.
        anim = GetComponent<tk2dAnimatedSprite>();
    }

    // This is called once the hit animation has compelted playing
    // It returns to playing whatever animation was active before hit
    // was playing.
    void HitCompleteDelegate(tk2dAnimatedSprite sprite, int clipId) {
        if (walking) {
            anim.Play("walkRight");
       
}
        else {
            anim.Play("idle");
        }
    }

    // Update is called once per frame
    void Update () {
        if (Input.GetKey(KeyCode.A)) {
            // Only play the clip if it is not already playing.
            // Calling play will restart the clip if it is already playing.
            if (!anim.IsPlaying("walkLeft")) {
                anim.Play("walkLeft");

                // The delegate is used here to return to the previously
                // playing clip after the "hit" animation is done playing.
                anim.animationCompleteDelegate = HitCompleteDelegate;
            }
        } else {

            if (!anim.IsPlaying("idle")) {
                anim.Play("idle");
                anim.animationCompleteDelegate = null;
                walking = false;
           
        }
}
     if (Input.GetKey(KeyCode.D)) {
            if (!anim.IsPlaying("walkRight")) {

                // Walk is a looping animation
                // A looping animation never completes...
                anim.Play("walkRight");

                // We dont have any reason for detecting when it completes
                anim.animationCompleteDelegate = null;
                walking = true;
            }
        }
 
}

}


3
Support / How do I get my animatedSprite to actually move?
« on: April 28, 2013, 01:51:28 am »
I just started 2D toolkit today, and I've been doing some tutorials but there isn't one for making the animated sprite actually move. The code that is given in the documentation just runs though the animations. How do I make it move. I know javascript, if that even means anything, and I could probably figure out some C# stuff. How would you guys do it, or how did you figure it out?

Thanks a million!

4
Support / Re: I can't add anything
« on: April 27, 2013, 08:23:08 pm »
After restarting unity everything started to work. I should have thought of that earlier...

Thanks for your help!

5
Support / I can't add anything
« on: April 27, 2013, 07:04:06 pm »
I just bought 2D toolkit today, and I can't add anything like the tile map or the tk2dTextMesh. I understand unity, kind of...but why are these things missing. If I go to component->2D toolkit and look at gui or sprite or anything like that it's all grayed out and I can't select it. Do I have to have unity pro for these features? Or do I have to download something else? Or do you add these things somewhere else?

Thanks for your time!  ;D

Pages: [1]