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

Pages: [1]
1
Support / Re: 2D toolkit incrasing performance
« on: April 17, 2014, 10:18:03 pm »
Sweet! what if i set a prefab inside one of the tiles in the Data tab of the tilemap? do those also get culled?

2
Support / 2D toolkit incrasing performance
« on: April 15, 2014, 05:10:10 pm »
Hey! So i wanted to create multiple levels for my 2d platformer. The only thing i was afraid of was the performance on mobile devices.

Is there a way to turn off (setactive = false) the tiles in a tilemap when off screen?
i.e. Pooling
Is there a way to access each tile programmatically or would that cost too much?

Thank you!

3
Support / Re: Grounded Linecast issues with animation
« on: April 14, 2014, 11:50:40 pm »
ok i fixed it. i didnt have the layers set up correctly. I think the player player layer was the same as the ground layer. i looked in unity's 2d example and fixed it.

Code: [Select]
grounded = Physics2D.Linecast(transform.position, groundCheck.position, 1 << LayerMask.NameToLayer("Ground")); 

4
Support / Re: Grounded Linecast issues with animation
« on: April 11, 2014, 02:51:16 pm »
yeah man, only the second log message. it always returns false. Both of the animations are set to loop. The player has a rigidbody attached and a box collider. And the tilemap ground has an edge collider attached when play is hit.

5
Support / Grounded Linecast issues with animation
« on: April 11, 2014, 06:32:12 am »
Hi im having some trouble playing my walk animation when the player is grounded.

When the player is not grounded, the jump animation should play, which works fine.
But when the player hits the ground, he just stops and stays in jump animation. The player should automatically start walking!
Please help!

I have a groundCheck game object set underneath the player
And jump animation is just one sprite looped.

Code: [Select]
tk2dSpriteAnimator animator;
private Transform groundCheck; // A position marking where to check if the player is grounded.
private bool grounded = false; //Whether or not the player is grounded.

// Use this for initialization
void Start ()
{
animator = GetComponent<tk2dSpriteAnimator> ();
groundCheck = transform.Find("groundCheck");

Invoke ("PlayInABit", 5f);
}

// Update is called once per frame
void Update ()
{
grounded = Physics2D.Linecast(transform.position, groundCheck.position, 1 << LayerMask.NameToLayer("Layer 0")); 

if(animator.IsPlaying("Walk") && animator.CurrentFrame >= 1)
{
transform.Translate (1.5f * Time.deltaTime, 0, 0);
}

if(grounded)
{
Debug.Log (grounded.ToString());
animator.Play ("Walk");
}
else
{
Debug.Log (grounded.ToString());
animator.Play ("Jump");
}
}

void PlayInABit()
{
animator.Play ("Walk");
}

Pages: [1]