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

Pages: [1]
1
Support / Re: Finding specific frames & a lack of accuracy?
« on: March 29, 2014, 12:48:51 am »
Well I decided to just try and re-rig the thing in a GUI, exact same results. So I guess this problem isn't relevant to 2DTK, enough though it initially seemed like it.

Thanks for reading... hopefully I'll figure something out.

2
Support / Re: Finding specific frames & a lack of accuracy?
« on: March 28, 2014, 11:38:05 pm »
I'm sorry, I'm not the most talented of programmers, so a lot of these things are over my head. I'm going to keep working on it, but I thought I'd post the updated code (all and all it has the exact same problem as what I have initially, it's just prettier). The current radial menu thing just has three options. If I put this code it, it works fine from the starting position:

Code: [Select]
if (Input.GetKey(KeyCode.I)) {
if(abilityPhase1){
if(Input.GetKeyUp(KeyCode.U) && sprite.CurrentSprite.name == "Radial1_Return")
sprite.SetSprite("Radial1_Feed");

if(Input.GetKeyUp(KeyCode.O) && sprite.CurrentSprite.name == "Radial1_Return")
sprite.SetSprite("Radial1_Sit");

With that you can properly scroll left or right once before it of course stops. But now, when I add the next two if statements...

Code: [Select]
      if(Input.GetKeyUp(KeyCode.U) && sprite.CurrentSprite.name == "Radial1_Feed")
sprite.SetSprite("Radial1_Sit");

if(Input.GetKeyUp(KeyCode.O) && sprite.CurrentSprite.name == "Radial1_Feed")
sprite.SetSprite("Radial1_Return");

It somehow breaks the first part that was initially working, and pressing either U or O will take you to Radial1_Sit, then nothing works. Using this strategy, there's another two statements that are needed, but if I add those, then nothing works at all. I'll keep working at it, but I don't even see why it's doing that

3
Support / Finding specific frames & a lack of accuracy?
« on: March 28, 2014, 05:01:51 am »
Hello readers,

So I'm having a bit of a problem, but first I'll explain what I'm trying to do. Basically I've created something that functions like a radial menu (think a pie slices into 5 pieces, each piece being an option you can select). Since the art I'm working with isn't very GUI friendly, I thought I'd do it in 2Dtoolkit. Basically I plan to have it cycle around, then based on what frame it's on when you press the select key, it will do whatever is shown.

The problem is, is that it just doesn't work. I'm starting small, with a three section radial. It starts on one frame, and if you press one key, it should scroll to the left, and to the right with the other key. Except it barely ever seems to do that. Sometimes I can get it to work going to the proper frame from to the left or right once from the starting point, but that's it. I've looked and tried a lot of things on this forum, but I haven't been able to find something that works. Here's my current strategy:

Code: [Select]


anim.Play ("Radial1");
anim.Pause();
                                if(Input.GetKeyUp(KeyCode.U) && currentFrame == 0){
anim.SetFrame(1);
currentFrame = 1;
}
if(Input.GetKeyUp(KeyCode.O) && currentFrame == 0){
    anim.SetFrame(2);
currentFrame = 2;
}
if(Input.GetKeyUp(KeyCode.U) && currentFrame == 1){
anim.SetFrame(2);
currentFrame = 2;
}
if(Input.GetKeyUp(KeyCode.O) && currentFrame == 1){
anim.SetFrame(0);
currentFrame = 0;
}
if(Input.GetKeyUp(KeyCode.U) && currentFrame == 2){
anim.SetFrame(0);
currentFrame = 0;
}
if(Input.GetKeyUp(KeyCode.O) && currentFrame == 2){
anim.SetFrame(1);
currentFrame = 1;
}


Looks pretty simple, but nothing ever seems to work right. I don't even know if the first frame in the animation counts as frame 1 or 0, but whatever number I put in doesn't seem to matter. I just have the three images of the radial set up in an animation. If anyone has any suggestions or better ways to do this, I would be really thankful. I only have a few days left to get this working.

Thanks for reading !

4
Support / Re: Only some sprite animations not playing properly
« on: June 13, 2013, 06:55:10 am »
At last! Okay so I've figured it out, thought I'd post the solution here so you have it in your.. records in case this case ever comes up again.

So, in order to determine which animation to play, my code will check a series of states: facingLeft, facingRight, isMoving, isAttacking, and isGrounded. Basically what was happening was that, for example, the left movement animation needed the following circumstances to play: facingLeft, isGrounded, and isMoving. Now, the left attack animation needed all those variables, as well as the isAttacking boolean to be true. What was happening in this specific case is that the left movement animation didn't actually care if isAttacking is true or not, and thus would always overwrite the left ground attack animation.

In some shape or form, this is ultimately what was happening for all the animations that did not play properly. The reason it worked say, before I added the attack animations and so forth, was that there were at the time less variables to check. Thus, the solution is to create a unique circumstance for each animation that utilizes all states in their if statement, even if they are irrelevant. It seems really obvious now that I write it out, but it clearly didn't seem like that's what was causing the issue. I think what threw us off was the fact that the first frame of the animation that should be playing would play, now that I understand the issue, I wouldn't have thought it would have played at all.

Cheers

5
Support / Re: Only some sprite animations not playing properly
« on: June 13, 2013, 05:26:29 am »
Alas, I just tried rigging that, and was unsuccessful. Before I go on, i'll post a sample to make sure we had the same idea:

At the start of the function I have all the states and things seprated, this being a sample (once more, inH is the horizontal axis value):

Code: [Select]
if(inH > 0) {
facingRight = true;
facingLeft = false;
isMoving = true;
        }
if(inH < 0) {
facingRight = false;
facingLeft = true;
isMoving = true;
        }
if(inH == 0 && facingRight == true) {
isMoving = false;
        }

Once all of those are done (and they all work as intended), I have the animation sections (in the same function):

Code: [Select]
       if(isMoving == true && facingRight == true){
if (!anim.IsPlaying("hero_WalkR")) {
                                anim.Play("hero_WalkR");
                         }
}
if(isMoving == true && facingLeft == true){
if (!anim.IsPlaying("hero_WalkL")) {
                               anim.Play("hero_WalkL");
                        }
         }

...and so forth. Unfortunately the results are the same, with the idle and walk animations working fine, but the jump and attack ones getting stuck on frame one. I also tried making another new animation to put in for jump as a test, but that did not make a difference either. I'm going to go ahead and post this, and am going to try something else. Right now, everything is in a MovementAnimations function being called in update. I'll start playing around with putting some of these in difference places, see if that makes any difference.

Edit 1: No luck yet, but I swapped the actual movement animation with the attack animation, and it played properly. At the very least that rules out there being something wrong with the actual animations

Edit 2: It's already late, but I think I'm onto something here. I commented out the walking animation script, and then if I was moving and held down the attack button, the attack animation would play. I think it has something to do with the idle/walk animations perhaps overwriting the others? More investigation is required

Edit 3: Yup, that's the problem, I haven't quite figured it out yet though, but here's some other things I noticed. If I leave the walk animations commented out, and move the jump animations above the idle animations, then jump and the ground attack animations will play ONLY when you are moving. However by doing this, then the air attack animation won't even trigger at all, and of course there is no walk animation. If you have any suggestions that would always be helpful, but I think I'll need to keep rearranging things until I find something that works. I'll keep this thread updated.

6
Support / Re: Only some sprite animations not playing properly
« on: June 12, 2013, 06:21:51 am »
Yeah, the correct animations are triggering, and as expected, they are constantly triggering, thus not allowing the animations to progress. I spent some time trying to find out what differences there could be between the walk/idle code and the jump/attack code that could be causing the latter to not work, even though the setup was identical.

-The walk left and walk right animations are triggered solely by the horizontal getAxis value   (these work fine)

-The idle left and right animations are triggered by a facingLeft or facingRight bool, which is determined by the last animation that played, as well as the horizontal axis value being zero  (these work fine)

-The jump animations are determined by the horizontal axis, the previously mentioned facingLeft/facingRight bool, and a bool that triggers when you are on a platform ("grounded") (these do not work)

-The ground attack animations are triggered by the grounded variable, and the facingLeft/facingRight variable, and these only trigger if a custom getAxis value is not 0 (these do not work)

So by looking at this, the common thing between the two groups that do not work is that grounded variable, yet if I remove it from say, the ground attack animations (leaving it just the facingLeft/Right bool), it still does not work (same goes if I delete the other and just leave grounded).

The only other difference I can think of is that all the bools are ultimately called in the update function, as in they are constantly triggering, while the getAxis values are basically either 1, -1, or 0. I don't see how that would make a difference, and the idle animations use these same bools, and those DO work. I should also note that I have checked time and time again that all the booleans are triggering properly. So anyways, I'm pretty stumped here. I can't even exactly tell if it's something wrong with my code, or if it's a 2D toolkit issue...

7
Support / Only some sprite animations not playing properly
« on: June 10, 2013, 11:07:11 pm »
Hello,

I'm working on a platforming game as a disclaimer. I have an idle and walk animation play that play properly, but for some reason, my jump and attack animations only play the first frame and freeze there. Usually there's the workaround of telling it to only play if it's not already playing, but that doesn't seem to work. Am I missing something here? I'll post a few code snippets and an explanation.

inH is the Horizontal axis value, the grounded boolean is just if you are in the air or not

Code: [Select]
if(inH > 0) {
            if (!anim.IsPlaying("hero_WalkR")) {
                anim.Play("hero_WalkR");
            }
facingRight = true;
facingLeft = false;
isMoving = true;
        }
if(inH < 0) {
            if (!anim.IsPlaying("hero_WalkL")) {
                anim.Play("hero_WalkL");
            }
facingRight = false;
facingLeft = true;
isMoving = true;
        }

so here's a part of [walking] code, this all works fine. Scroll down a few lines to find the jump code, which only gets stuck on the first frame

Code: [Select]
if(grounded == false && inH > 0){
if (!anim.IsPlaying("hero_JumpR")) {
                anim.Play("hero_JumpR");
            }
facingRight = true;
facingLeft = false;
isMoving = true;
}
if(grounded == false && inH < 0){
if (!anim.IsPlaying("hero_JumpL")) {
                anim.Play("hero_JumpL");
            }
facingRight = false;
facingLeft = true;
isMoving = true;
}
          //later on in the code (for attacking, which also gets stuck on frame 1)
if(grounded == true && facingLeft == true){
if (!anim.IsPlaying("weapon1_groundL")) {
                anim.Play("weapon1_groundL");
anim.animationCompleteDelegate = null;
            }
}


I should also note I'm just one version of 2Dtoolkit behind the current one. I should also note that the grounded, facingLeft/Right, etc booleans all trigger properly for sure. I will happily provide anymore needed information.

Thanks

8
Support / Re: Getting an error when trying to make animations
« on: May 29, 2013, 10:12:17 pm »
I went ahead and tried the things suggested in your link. The default quality was already correct, and the second suggestion made no difference.

However I guess I did find a fix. I reimported a few of the images into unity and made a new sprite collection and animation, and those were not blurry at all. The image hadn't been altered, but you can put the new and the old ones side by side and it's a really obvious difference. I was even able to literally grab the same PNG out of the assets folder and drag it back into unity, and that worked too.

 For now this fix is fairly viable, since I was going to replace these graphics sooner or later anyways, but it's bizarre. I wonder if it has anything to do with 2D toolkit at all. If that error from earlier ever returns though, I'll bump this thread

9
Support / Re: Getting an error when trying to make animations
« on: May 29, 2013, 08:06:27 pm »
So there's been a twist of events. I was getting ready to prep a new file to send your way, and now the error will not trigger anymore. I should note that I had changed nothing from the original project where it was happening, I had just duplicated the folder, opened that, and the error stopped triggering (in both of them).

However, now all my sprites are incredibly blurry, whether you are viewing them in the scene, or in the animation editor (etc). I tried deleting and re-importing 2D toolkit, but that didn't change anything anyways. Do you have any ideas of what might be causing this? Would you like to see the file?


Thanks for bearing with me here

10
Support / Re: Getting an error when trying to make animations
« on: May 29, 2013, 04:22:15 am »
So I just prepped a file to post here. I had deleted all but 1 sprite out of each collection, and any other stuff. However, now the error will no longer trigger in that file, but I'm not sure why. The only thing I could think that would effect it is the reduced size, but it was only around ~25 images, 400x400 being the largest. That wouldn't explain why the error triggered with one of the default sprite collections.

I'll investigate it further over the next 1-3 days and report back anything I find. Or if you would like, I could post a version that still has all the sprites in it.

11
Support / Getting an error when trying to make animations
« on: May 28, 2013, 09:42:28 pm »
Hello,

In my project I have stumbled upon an error that triggers when I try to make a new animation clip. The error itself triggers when I choose a sprite collection to make the animation with. However, it does not trigger with every sprite collection, just some of them (including one of the demo ones that comes with 2DToolkit). I was unable to find any notable differences between ones where the error triggered and ones where it did not. I should also confirm that I'm using the most recent version of 2DToolkit, but not the most recent version of unity (I'm only an update or two behind though).

Here's the full error that triggers:

Quote
IndexOutOfRangeException: Array index is out of range.
tk2dEditor.SpriteAnimationEditor.TimelineEditor.DrawFrameGroupEx (Rect r, .tk2dSpriteAnimationClip clip, tk2dEditor.SpriteAnimationEditor.FrameGroup fg, Boolean highlighted, Boolean showTime, Boolean playHighlight) (at Assets/TK2DROOT/tk2d/Editor/Sprites/SpriteAnimationEditor/tk2dSpriteAnimationClipTimelineEditor.cs:525)
tk2dEditor.SpriteAnimationEditor.TimelineEditor.DrawFrameGroups (Int32 controlId, Rect frameGroupRect, .tk2dSpriteAnimationClip clip, System.Collections.Generic.List`1 frameGroups, Single clipTimeMarker) (at Assets/TK2DROOT/tk2d/Editor/Sprites/SpriteAnimationEditor/tk2dSpriteAnimationClipTimelineEditor.cs:211)
tk2dEditor.SpriteAnimationEditor.TimelineEditor.Draw (Int32 windowWidth, .tk2dSpriteAnimationClip clip, System.Collections.Generic.List`1 frameGroups, Single clipTimeMarker) (at Assets/TK2DROOT/tk2d/Editor/Sprites/SpriteAnimationEditor/tk2dSpriteAnimationClipTimelineEditor.cs:158)
tk2dEditor.SpriteAnimationEditor.ClipEditor.Draw (Int32 windowWidth) (at Assets/TK2DROOT/tk2d/Editor/Sprites/SpriteAnimationEditor/tk2dSpriteAnimationClipEditor.cs:564)
tk2dSpriteAnimationEditorPopup.OnGUI () (at Assets/TK2DROOT/tk2d/Editor/Sprites/SpriteAnimationEditor/tk2dSpriteAnimationEditorPopup.cs:480)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/3df08680c6f85295/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)


I found a thread here that seemed to have a similar problem ( http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,1301.msg7574.html#msg7574 ), but even after making the change to the code suggested there, it didn't seem to make a difference.

Any help is much appreciated.

12
Support / Re: Draw order changing on perspective?
« on: September 25, 2012, 12:00:38 am »
thanks, I'll give it a try

13
Support / Draw order changing on perspective?
« on: September 23, 2012, 07:17:07 pm »
Hello - I'm a new tk2D user, and wanted to start off by importing a character sprite made up of a few different parts. However, in both the game viewer and the scene viewer, depending on what angle I'm looking at my sprite, certain parts will appear in front of others, and vice a versa. I should note that this is not with just the camera, but with the general viewer as a whole. Placing pieces of the sprite slightly behind others does not seem to help, unless its way back and thus starts to look too 3D.

I've looked around and found similar problems, but no solutions that helped me, can anyone here help me out?

Thanks

Pages: [1]