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 - cypher123

Pages: [1]
1
Support / Re: help with stopping animation/checking when done
« on: July 23, 2013, 03:59:46 pm »
AHHH, I found the problem. I had duplicate file names for the collection and animation and the duplicates had it set to loop and they were hidden deep in my project and named the same as the current collection/animations thanks so much for your help! I've honestly been confused for the past 2 days over this....

2
Support / Re: help with stopping animation/checking when done
« on: July 23, 2013, 02:32:24 pm »
yea it is saying loop, even though looking in the sprite animation it says once for both idle and attack.

3
Support / Re: help with stopping animation/checking when done
« on: July 22, 2013, 08:39:20 pm »
I've tried dozen's of different ways with settings attack to true. sorry I had attack = false; in both the PlayIdle function and if anim.Play("idle");. i've set a bunch of debug.logs("") around and PlayIdle never gets hit ever for animation complete. Also I tried setting the idle to play once and it plays endlessly as well. Also tried just doing anim.Play("attack"); in the Start() and it plays attack endlessly there as well. Can you give me any advice on how to go about doing this? Because this obviously isn't working. Attack just stays true, is there another way to check if an animation is complete?

4
Support / help with stopping animation/checking when done
« on: July 22, 2013, 07:18:54 pm »
So, I have 2 animations attack and idle, idle is a loop and attack is set to once. I have the sprite with the sprite animator and this code below attached to the sprite. The animations work well the idle loops, but when I set attack to true the attack animation plays forever even though it is set to once. It seems AnimationCompleted  never gets hit, am I doing something wrong with AnimationCompleted? I want the animation to just play once then go back to idle.


Code: [Select]
public bool attack { get; set; }

private tk2dSpriteAnimator anim;

void Start() {
anim = GetComponent<tk2dSpriteAnimator>();

attack = false;
}

void PlayIdle(tk2dSpriteAnimator sprite, tk2dSpriteAnimationClip clip) {

anim.Play("idle");
}



void Update() {

if (attack) {

if (!anim.IsPlaying("attack")) {
anim.Play("attack");

anim.AnimationCompleted = PlayIdle;
}
}else{
if (!anim.IsPlaying("idle")) {


anim.Play("idle");

anim.AnimationCompleted = null;

}
}
}

5
Support / Re: Reference problems
« on: July 18, 2013, 07:48:25 pm »
thanks that worked, do you mind if i ask another question here? about AnimationCompleted how does it work exactly because I have it like so.

void PlayIdle(tk2dSpriteAnimator sprite, tk2dSpriteAnimationClip clip) {
      anim.Play("idle");
      attack = false;
   }
   

   void Update() {
      Debug.Log("attack: " + attack);
      if (attack == true) {
         if (!anim.IsPlaying("attack")) {
            anim.Play("attack");
            anim.AnimationCompleted = PlayIdle;
            
            
         }


thats just a small bit, but it doesn't seem to stop the attack animation at all when I set it to true from another script.

6
Support / Re: Reference problems
« on: July 18, 2013, 02:43:42 pm »
Assets/TK2DROOT/tk2d/Code/Sprites/tk2dSpriteAnimator.cs(9,14): error CS0101: The namespace `global::' already contains a definition for `tk2dSpriteAnimator'

is the error, I get the same error just for different .cs files.

So This is how I created the animations, I made a tk2dcollection and a tk2danimation. I created a empty gameobject and added tk2dSprite and tk2dspriteanimator and added the tutorialanimcontroller.cs to the gameobject as well. I'm refering to a solution in my visual studios that contains my scripts for my unity project, but doesn't contain the tk2d scripts.

7
Support / Re: Reference problems
« on: July 17, 2013, 08:45:46 pm »
I'm using C# and I have created the tutorialanimcontroller.cs you have on your site and it is giving me using errors for tk2dSpriteAnimator and tk2dSpriteAnimationClip, So I add the tk2dSpriteAnimation.cs and tk2dSpriteAnimator.cs to my solution and it seems to resolve the reference errors but in unity I get Assets/TK2DROOT/tk2d/Code/Sprites/tk2dSpriteAnimator.cs(9,14) error : the namespace 'global::'  already contains a definition for tk2dSpriteAnimation and the same for spriteanimation. I run the integrity checker before I add them to my solution and it says it is fine but after it says the same errors. Overall I have a sprite with an animation and also the tutorialanimcontroller.cs is attached and I'm trying to have it so I can access that tutorialanimcontroller.cs in another script called battle.cs and to change it when certain animations should play based on what happens in the battle.cs.

8
Support / Reference problems
« on: July 17, 2013, 04:57:20 pm »
My main question is how do I reference the tk2d scripts without causing massive problems.
My problems are I am following the sample animator script and I want to reference that script but It says tk2dSpriteAnimator and tk2dSpriteAnimationClip are missing using directives, so I added tk2dSpriteAnimator  and tk2dSpriteAnimation to my solution that seems to solve the reference problem but then I get instant errors in unity about those two scripts namespace already being in global::.
Any suggestions?

Pages: [1]