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

Pages: [1]
1
Support / Re: tk2dSpriteAnimator become null (sometimes)
« on: October 21, 2013, 02:11:54 pm »
Seems like the reference that has gone null
to stop the error I am now doing this,

Code: [Select]
anim = gameObject.GetComponentInChildren<tk2dSpriteAnimator>();
the problem is I can't simulate the problem without adding large number of units to the screen. It does not happen if I have few units on the screen

As you can see from the previous code I am in the process of destroying the main game object when the health goes below 0.
what I am doing is playing death animation and at the end I am destroying the gameObject

 

2
Support / Re: tk2dSpriteAnimator become null (sometimes)
« on: October 21, 2013, 01:28:44 pm »
tk2dSpriteAnimator is a child object inside the main object.
I never destroy the animator.

if the parent object is active tk2dSpriteAnimator should be there too right?

3
Support / tk2dSpriteAnimator become null (sometimes)
« on: October 21, 2013, 12:07:28 pm »
I have following code in my take damage function
Code: [Select]
if (isAlive)
        {
            towerHealth -= damageAmount;
            if (towerHealth <= 0)
            {

                isAlive = false;
                anim.Stop();

            }
        }

This works properly most of the time.
But once in a while I get following error, NullReferenceException: Object reference not set to an instance of an object

I trace the error to anim (tk2dSpriteAnimator) becoming null.
The main game object with the sprite is active, any idea how this could happen?

Any advice on how to fix this?

4
Support / tk2d camera empty screen
« on: October 20, 2013, 05:44:12 am »
My game with normal camera is working well. Then I add tk2dcamera to the scene with default setting.

Now nothing is shown in game window.

tk2dcamera preview also shows nothing. But the camera preview shows the scene.

the game contents are clearly within the boundary of the camera.

when I closely examine the game window I can see something very small on the bottom left corner of  the screen. It looks like the content of the scene.

How do I fix this issue?


5
Support / How to play correct animation based on direction?
« on: August 15, 2013, 09:25:05 am »
I am making a tower defense game and I am using 2d toolkit to animate the creeps.  I have 4 animations for left, right, up and down movement. I also have the direction vector of the creep.

How do I decide which animation to play using the direction vector?

For each Update I need to do a test to decide which animation to play.
Even if the creep is move at an angle I should still select one of these animations. 
Looking for a simple method to decide on the correct animation.

If I do this direction test by adding a animation event will that be less costly than doing the direction test in Update() function. My animations have 8 frames

6
Support / tower defense game using 2d toolkit
« on: August 05, 2013, 05:00:15 pm »
I am planing to do an isometric  tower defense game using 2d toolkit.
I can't find any guideline how to go about doing this.

I have seen examples of 3D tower defense games. May I know doing this in 2D a bad idea?

Can anyone give some direction on how to do this?

Is there any simple tutorial showing how to do a isometric game using 2d toolkit? 

7
Support / One big atlas or many small atlases, what is better?
« on: August 01, 2013, 11:02:03 am »
In my unity iPhone game I have lot of sprites and animations. I have created 2048 x 2048 atlas and few smaller atlases.

My question is should I keep 2048 atlas or break it in to smaller atlases.

What is the most efficient way?
I have noticed it take some time to load my scene. So I wanted to improve loading time …

8
Support / Re: How to transit between 2 animations
« on: May 10, 2013, 04:37:17 am »
since my walking animation is looping animation will it stop playing?

9
Support / How to transit between 2 animations
« on: May 09, 2013, 10:09:42 am »
I have idle animation and walking animation. Idle animation wrap mode is set to single and walking animation set to loop.

When the player stops moving I want to continue the walking animation till the end then go to idle animation.

How to do this from code?

10
Support / Can't see the animated sprite
« on: May 08, 2013, 12:05:16 pm »
I am having hard time understanding how MakePixelPerfect works.

I am trying to add animation to the game. When I add the animated sprite to scene the sprite is very small, can’t even see it. I can re-size the sprite and make it display when the game is running.

Instead of re-sizing the sprite I did following from code;

Code: [Select]
private tk2dAnimatedSprite anim;

void Start ()
{
anim = GetComponentInChildren<tk2dAnimatedSprite>();
anim.MakePixelPerfect();
}

Now I can see the animated sprite, but the scale is still 1,1,1

I also tested the game in different resolutions and the sprite is somehow scaling correctly.  What is the reference it uses to scale to different screen sizes?
My game will run on different screen sizes so do I have to use MakePixelPerfect or scale the sprite myself?

Pages: [1]