2D Toolkit Forum

2D Toolkit => Support => Topic started by: DahongPunyal on January 23, 2014, 01:43:43 am

Title: tk2dSprite Masking
Post by: DahongPunyal on January 23, 2014, 01:43:43 am
I am new to tk2d (also in Unity) and I want to know if it possible to create a game object for background (tk2dSprite attached), then create another game object on top of it (also attached with tk2dSprite). The second game object is for overlay and I want to add a clipping mask to it (a circle mask, so it will look like a hole). And then I will add another game object for my main sprite.

Also, I want the mask animate or change its size for a duration. Like, from small to big and vice versa. Is it possible to achieve this using tk2d or I need other library to do it?

Here's what I want to do:
(http://i40.tinypic.com/155l8ck.jpg)

Thanks!
Title: Re: tk2dSprite Masking
Post by: unikronsoftware on January 23, 2014, 11:11:01 am
It can be done but you will have to implement it yourself using shaders. If its just the background, making a custom shader is the quickest / easiest way to do this. You won't even need an atlas for that, which makes it even easier.
Title: Re: tk2dSprite Masking
Post by: DahongPunyal on January 23, 2014, 12:15:24 pm
Thanks!

Can you give a link for a good tutorial of creating custom shader? I am new to Unity3D and it will be my first time to write one. :D
Title: Re: tk2dSprite Masking
Post by: unikronsoftware on January 24, 2014, 11:06:12 am
There are quite a few shader tutorials. I suggest reading up about them, you will open up a lot more options. Its pretty straightforward once you get the hang of it, and you'll only need a bit more than the basics for what you need.
http://unitygems.com/noobshader1/
Title: Re: tk2dSprite Masking
Post by: DahongPunyal on January 25, 2014, 01:54:32 am
Thanks! :D

Closed