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

Pages: [1] 2
1
Support / Re: tk2d camera, empty screen
« on: October 08, 2014, 09:03:24 am »
Haha, after several years i had returned to Unity and 2dtoolkit and again i faced the same issue with empty camera xD
Interesting thing is that i had found only my own post about this issue :))

The thing was that i created new sprites when camera was selected. New sprite is a child of a camera, though it has position (0,0,0), it is still behind the camera :)

2
Support / Re: Problem with font.
« on: May 15, 2012, 08:26:12 am »
Had the same here, try another program for font generation.

I have another font question: how to manage layer of the font, i didnt find it in the settings. On the test scene, I have 1 animated sprite and 1 text mesh. And sprite is rendered after, so i cant see whole text. Any workaround?

Got it: just change Z coordinate.

3
Support / Re: FinishLoad event?
« on: May 13, 2012, 11:26:12 am »
Pretty simple. I made an empty level with simple cycling animation. And this code, attached to object.

Code: [Select]
private AsyncOperation ao;

void Start()
{
ao = Application.LoadLevelAsync("Level1");
if (ao != null)
{
//GUI.Box(new Rect(0, Screen.width - 40, ao.progress * Screen.width, 40), "");
Debug.Log(ao.progress.ToString());
}
}

4
Support / Re: Simplest way to draw a line.
« on: May 13, 2012, 09:33:49 am »
Did you tried it?

I have a deadline quite close, so it would be really cool, if you can provide the code example of drawing a simple line  ;D

5
Support / Simplest way to draw a line.
« on: May 12, 2012, 02:03:34 pm »
Its me again :)

Now i'm trying to draw a line, using 2dtools.

* This morning i tested Vectrocity, but it failed because of cameras.
* Some minutes ago, i tried to draw a line with Shuriken particles system, it also failed. Possibly, because of coordinate system. Tried to get coordinate of anchor and draw a line between 2 anchors - it failed also.
* Now i tried to draw line with Debug.DrawLine(), but i still see nothing.

Any recommendations, where to look?

6
Support / Re: FinishLoad event?
« on: May 12, 2012, 12:59:21 pm »
Ok, i'll share working results, if needed :)

7
Support / Re: FinishLoad event?
« on: May 12, 2012, 11:47:37 am »
And what about first level?

Should i use it this way ?
1) show a picture (or animation) with "Loading" line - actually, not just a picture, but a whole level
2) during it, Application.LoadLevelAsync 
3) when finished, destroy picture

PS: i hope, this one also would be useful for other users

8
FAQs / Re: Font transparency
« on: May 12, 2012, 11:39:30 am »
Thanks for really fast answer :)

I guess, this is nice question to your FAQ collection.

9
FAQs / Font transparency
« on: May 12, 2012, 11:09:12 am »
Tried
textHero.color.a = 10;

but it is not possible to set value this way.

10
Support / FinishLoad event?
« on: May 12, 2012, 10:24:14 am »
Is it possible to have such kind of event? As i told before, i have lots of quite heavy animation. I'd like to know, when it loads completely (to show a loading screen, or so).

11
Support / Re: Get current frame?
« on: May 12, 2012, 09:51:14 am »
Also, probably, it is nice idea to add
Code: [Select]
public void Play(int id, float clipStartTime)
{
isReversed = false;
****

12
Support / Re: Get current frame?
« on: May 12, 2012, 09:25:42 am »
Moreover, if anybody would need isReversed flag - here it is:

Code: [Select]
public class tk2dAnimatedSprite : tk2dSprite
{
public int currFrame = 0;
public bool isReversed = false;

********

void Update ()
{
#if UNITY_EDITOR
// Don't play animations when not in play mode
if (!Application.isPlaying)
return;
#endif

if (g_paused || paused)
return;

if (currentClip != null && currentClip.frames != null)
{
clipTime += Time.deltaTime * currentClip.fps * ((isReversed)?-1:1); // modified

if (currentClip.wrapMode == tk2dSpriteAnimationClip.WrapMode.Loop || currentClip.wrapMode == tk2dSpriteAnimationClip.WrapMode.RandomLoop)
{
currFrame = (int)clipTime % currentClip.frames.Length;
if (currFrame <0) currFrame += currentClip.frames.Length; // added
SetFrameInternal(currFrame);
}
else if (currentClip.wrapMode == tk2dSpriteAnimationClip.WrapMode.LoopSection)
{
currFrame = (int)clipTime;
if (currFrame >= currentClip.loopStart)
{
currFrame = currentClip.loopStart + ((currFrame - currentClip.loopStart) % (currentClip.frames.Length - currentClip.loopStart));
}
if (currFrame <0) currFrame += currentClip.frames.Length; // added
SetFrameInternal(currFrame);
}
else if (currentClip.wrapMode == tk2dSpriteAnimationClip.WrapMode.PingPong)
{
currFrame = (int)clipTime % (currentClip.frames.Length + currentClip.frames.Length - 2);
if (currFrame >= currentClip.frames.Length)
{
int i = currFrame - currentClip.frames.Length;
currFrame = currentClip.frames.Length - 2 - i;
}
if (currFrame <0) currFrame += currentClip.frames.Length; // added
SetFrameInternal(currFrame);
}
else if (currentClip.wrapMode == tk2dSpriteAnimationClip.WrapMode.Once)
{
currFrame = (int)clipTime;
if (currFrame <0) currFrame += currentClip.frames.Length; // added
if (currFrame >= currentClip.frames.Length)
{
currentClip = null;
OnCompleteAnimation();
}
else
{
SetFrameInternal(currFrame);
}

}
}
}

"Loop" mode works fine for me. Though, not sure about other modes (especially about WrapMode.Once). But now it works like this:
Code: [Select]

if (Input.GetMouseButtonDown(0))
{
anim.isReversed = false;
}
if (Input.GetMouseButtonDown(1))
{
anim.isReversed = true;
}

Debug.Log(anim.currFrame);

13
Support / Re: Get current frame?
« on: May 12, 2012, 08:55:51 am »
Not sure if this is supposed way of solving this problem, but minor changes in tk2dAnimatedSprite.cs do the work.

Just added to definition section
public int currFrame = 0;

and removed "int"s before all currFrame in void Update ()

14
Support / Get current frame?
« on: May 12, 2012, 07:51:28 am »
Looked through reference for AnimatedSprite, found void tk2dAnimatedSprite.SetFrame(int currFrame   )   
http://unikronsoftware.com/2dtoolkit/doc/html/classtk2d_animated_sprite.html

But how to get current frame? For example, i need forward and backward animation. How can i reverse it?

Something like
Code: [Select]
if (Input.GetMouseButtonDown(0))
{
frameCurrent = anim.GetFrame();
anim.PlayFromFrame("Forward",frameCurrent);
}
if (Input.GetMouseButtonDown(1))
{
frameCurrent = anim.GetFrame();
anim.PlayFromFrame("Reverse",frameCurrent );
}

Kinda this:
Left Mouse Button - 0-1-2-3-4-5- Right Mouse Button - 5-4-3-2-1-0-30-29-28-27 - Left Mouse Button - 27-28-29-30-0-1-2- ...

PS: ideally, i think something like field Reverse should do all this stuff.

15
This is not a huge issue, though, i think you're interested in it.

I have number of sprites Sprite_001.png - Sprite_300.png.
They are split into different folders: Sprite_001.png - Sprite_070.png are in Stand folder, Sprite_071.png - Sprite_150.png are in Walk folder and so on.

I create new Sprite Animation, select Walk collection, and is shows first sprite with number Sprite_086.png, not Sprite_071.png.
As i said, not a huge issue, but still unpleasant.

Pages: [1] 2