2D Toolkit Forum
2D Toolkit => Support => Topic started by: chobi77 on September 08, 2012, 03:45:39 pm
-
Hi all,
I am doing a check to see if an animation is playing so i can get Mario to walk after he lands from a jump and make the jump animation stop.
The problem is that the code i am using does not work, i have seen examples here and they seem to be working for others so i would like to figure out where i am going wrong.
if (velocity.x < 0)
{
velocity *= walkSpeed;
if (anim.isPlaying() && anim.currentClip.name != "MarioSmallWalkLeft")
anim.Play("MarioSmallWalkLeft");
jumpEnable = false;
}
the problem is with the if (anim.isPlaying() && anim.currentClip.name != "MarioSmallWalkLeft") line.
the error i am getting is `tk2dAnimatedSprite.currentClip' is inaccessible due to its protection level.
Can anyone shed any light on why this is happening?
Thanks.
-
The one you want is CurrentClip, thats the public property.
-
Thanks for the quick reply.
I changed it to CurrentClip and now i get this error.
Type `tk2dAnimatedSprite' does not contain a definition for `CurrentClip' and no extension method `CurrentClip' of type `tk2dAnimatedSprite' could be found (are you missing a using directive or an assembly reference?)
any ideas?
-
Its likely you're using an old version. What version are you on?
-
version 1.51
:)
-
Might be a good idea to update, that's an ancient version you've got there...
-
Oh wow yes, that never occurred to me...
Seems i also have to upgrade Unity to 3.5.5 as well.
Thanks for that, i hope all this works when i finish upgrading. :)