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

Pages: [1] 2 3 ... 5
Support / Re: Help with Returning to a Sprite after Animation Ends
« on: September 27, 2013, 10:45:20 pm »
The docs here show how it is done.

It uses delegates, which basically allow a method to be assigned as a parameter, and that method is then called when the animation finishes.

Here are the relevant bits from the above docs. You set up a method with the required signature:

Code: [Select]
void HitCompleteDelegate(tk2dSpriteAnimator sprite, tk2dSpriteAnimationClip clip) {
        //code in here will be executed when your anim is finished

And then after you start your animation, you tell it to call the above method when it's finished, like so:

Code: [Select]
anim.AnimationCompleted = HitCompleteDelegate;

Support / Re: Graphical glitches when using ZoomScale
« on: September 21, 2013, 12:36:54 am »
Does zooming cause things to no longer fall on pixel boundaries?

Support / Re: How to Whiten a Sprite Gradually
« on: September 19, 2013, 11:37:57 pm »
I think you would need to make a custom shader.

You could copy and change an existing tk2d shader so that the vertex colour is added instead of multiplied. Your sprite colours would then need to be black instead of white by default to be in their 'normal' state. Then when you lerp the tk2d sprite colour to white, the sprite pixels should move towards a solid white instead of being tinted. That's my theory anyway. :)

Support / Re: tilemap surface properties
« on: September 17, 2013, 06:00:15 am »
Each tile type can have data attached to it - string, int and float. You can use these to represent whatever you want.

Set their values in the tilemap editor (Data tab) and when the character is over a tile read in the appropriate value using GetTileInfoForTileId and act accordingly.

Support / Re: Sprite Visibility
« on: September 17, 2013, 05:49:27 am »
Yes, you can set the 'enabled' property on the sprite component.

Support / Re: Sprite + Normal Map
« on: September 16, 2013, 11:26:16 pm »
The link still works for me. I think there are a few threads about this, try searching.

In general you just manually maintain a second Collection that is your normal map. Disable trimming on both and add the sprites in each Collection in the same order. Each time you update the normal map collection you need to manually set compression method on the resulting atlas texture to 'normal map'. But you can modify tk2d code to add this as a choice in the compression drop-down quite easily.

Sprites meshes need normals and tangents, currently I think this only works for standard sprites (and not tiled/diced/tilemaps) so you need to put your own generation code in if you want those to work.

Support / Re: Replacing physics with Box2D?
« on: September 14, 2013, 04:29:05 am »
Unikron has said that they will be supporting Unity's upcoming native box2d implementation, but I doubt that will happen until some time after Unity 4.3 is released for obvious reasons.

Until then - 2d Toolkit doesn't really have physics per se, it just generates Unity colliders for you automatically. So you can set that to "none" and use whatever you like.

Support / Re: How to instantiate a prefab
« on: September 09, 2013, 11:15:24 pm »
You can do it via Resources.Load or via a prefab reference in your script that you have dragged/dropped using the inspector.

Sprite is a component on a Gameobject and you won't be able to Instantiate one directly - you will need to use GetComponent if you want to access its api.

If using Resources.Load you need to include the path if it is in a subfolder, so "Prefabs/Level_01_Egg". It's returning null because it can't find the object.

Support / Re: New Unity 2D Tools this fall
« on: September 07, 2013, 11:56:42 pm »
So the Unite 2d (and gui) videos were released, and they said that the atlas packing was a pro-only feature! Also that 4.3 was now in beta.

Support / Re: Tilemap Tile Changing
« on: September 06, 2013, 03:25:33 am »
Most likely that is from an old thread - I think Tilemap was officially 'released' in version 2.1, and it certainly is now supported. I've personally used SetTile and Build at runtime so it does work.

Support / Re: Tilemap Tile Changing
« on: September 05, 2013, 08:43:09 am »
Yes, you need to update by calling Build() after changing the tile. It's done this way so you can change lots of them if needed and then update the mesh at the end.

Support / Re: Will sunshafts work with 2dtk?
« on: September 03, 2013, 12:17:09 am »
What about with sprites that write to the depth buffer, like clip shader?

Support / Re: Setting a tk2dSprite scale in scripting
« on: September 01, 2013, 11:53:46 pm »
Don't use the transform, use the scale property on the tk2dSprite class.
I've seen the tk2dSprite class but I am unsure how to call from it because I am using a different script that I attached to the object.

It's like anything in Unity where you need a script to talk to another component, either use GetComponent in your script or make a variable that you can drag-and-drop the sprite onto in the inspector. See the Unity docs for details.

c# example of getting the sprite component and changing the scale to 2:
Code: [Select]
tk2dSprite sprite;
sprite = GetComponent<tk2dSprite>();
sprite.scale = new Vector3 (2,2,2);

But as Unikron said, changing the scale on the transform should work. You will most likely need to attach an example so someone can check it out and see what is wrong.

Support / Re: Setting a tk2dSprite scale in scripting
« on: September 01, 2013, 05:03:27 am »
Don't use the transform, use the scale property on the tk2dSprite class.

Support / Re: New Unity 2D Tools this fall
« on: August 30, 2013, 12:59:54 pm »
Are there any videos around yet of the gui and 2d talks that were on the same day as the keynote?

Pages: [1] 2 3 ... 5