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

Pages: 1 [2] 3 4 5
Support / Re: Question regarding dicing.
« on: March 29, 2014, 06:17:56 pm »

Thanks. You are right, they will be animated. Sprite sheet's size is 1890x860 and contains 9 instances of 210x860. So you suggest to not even do dicing and leave everything on default?

Also from that 4 files, each 2 of them are very similar and share a lot, if that helps to suggest a better method.

BTW, I was reading this:
and the last part regarding advanced dicing seemed like what I asked here but could not figure it out, is it reverent to my question here?

Support / Question regarding dicing.
« on: March 29, 2014, 05:42:56 pm »

First of all, thank you for this package.

I have a question regarding dicing. I have some very large spritesheets that I need to put in the game via tk2d and alot of those single sprites in that sprite sheet have a lot in common as each of them only is different slightly than the other one and wanted to know if it's possible for sprites to share same pool of diced sprites.

Let me rephrase it since it might not have been clear.

When I import a sprite sheet and make a collection out of it, I can change their render mesh to dice so the parts that are duplicated, would not take additional space and that's great. BUT is it possible for several sprites in same collection to share a pool of diced sprites so like 10 sprites that have a lot of texture in common would take less space?

Thanks man.

BTW, if you have any other suggestion on how to handle such sprite sheets in tk2d, I would be more than happy to hear it as I have to deal with 4 of these.

Support / Best solution for large backgrounds that are not tilable?
« on: March 19, 2014, 06:19:22 am »

I have some big full screen images like 960x640 that doesn't have repeating parts so dicing won't help. Was wondering which tk2d's data type would do them best. I read your other post and used "Create sprite from image" method, but was wondering if there is a better solution.


For future reference and anyone finding this via search, here is how I did it. Replace this from tk2dUITextInput.cs:

If I don't want to modify tk2d, should I make this protected, inherit from this class and then override this method with my own?


Is there any way to prevent user from entering any text beside standard English, like Farsi/Arabic?

Support / How to get input and output of Arabic/Persian/Farsi texts?
« on: March 15, 2014, 02:05:17 am »

I was wondering on how to get Arabic/Farsi text input vai tk2d's input texts and also what should I do if I want to have Arabic/Farsi text on button labels, a.k.a. text meshes.



I was using OnClick but apprently Toggle event was meant to be used for those toggle controls. Only if tk2d had better documentation ...

Support / Can we have control before a toggle button changes state?
« on: March 01, 2014, 10:12:48 pm »

Is there any even that is fired before a toggle contro's IsOn state changes?

What I want is to have some control when player presses a toggle button control but before it actually toggles it, I want to cancel the toggle based on some criteria.

In other words, If you press a toggle button, I want to catch that event, do some checks and if it's valid, let the toggle button change it's state and if the calculations return false, I show an overlay screen and toggle button should not have changed it's state.

Is there like a click or something that toggle button has that help me do that?


Support / Is it not definite when some internal functions are called?
« on: February 26, 2014, 03:58:26 pm »

I'm making some UI with tk2d and used some Checkbox prefab from tk2d to do so. What I do is I check if the Checkbox's GetComponent<tk2dUIToggleControl> ().IsOn is true, I do something then toggle it and by default when the game starts, all the buttons are ON.

Problem is, when I click on these check boxes that are duplicates of each other, in OnClick event, 2 of them report IsOn as False and 3 of them report it as True.

What I assume is that somewhere in tk2d, they are first toggled off and then my OnClick event handler runs but for 3 of them, I first get the Onclick event handler then tk2d (or Unity) takes control and sets it off.

Check thise scene: https://www.dropbox.com/s/n4s2mifi0os7507/shop.unitypackage
(It doesn't have your package)

And check the OnClick event for first button and 2nd button from the left for example. In ShopController.cs file, in Toggle_Equip_Of_PowerUp_1_Click if you put a debug.log you can see that it returns True for IsOn and it's good and what I expect it because in the scene it's toggled true for Is On but the second button from the left's Toggle_Equip_Of_PowerUp_2_Click returns false for IsOn check.

Hope it shows the same behavior on your system as well.

Let me know if you have problem reproducing it.


Support / Re: How to have a draggable object with 2D toolkit?
« on: February 18, 2014, 07:55:34 pm »
Thanks man, solved it with two different approaches and I post them here for future reference:

1- Storing start and end position of touch and then reduce the end from start and use that vector as force to rigidbody.

2- Storing last n positions of touch, then calculating vector between each two that are next to each other, then calculate average of those vectors and pass it to addForce.

I know most of this topic was not 2d toolkit related at all and I appreciate your helps very much.

Support / Re: How to have a draggable object with 2D toolkit?
« on: February 18, 2014, 01:07:09 am »

I followed your advice and did this:

1- In ButtonDown() call of tk2dUIDragItem_idn (my copy of tk2dUIDragItem), I stored startPosition via newWorldPos or offset

2- In the ButtonRelease, I tried to minus the end position from the start position via:

vector3 direcionToLaunch = transform.position - startPosition;

and then call addForce with this direcionToLaunch. But it doesn't work.

What I suspect is that I'm not getting correct position from tk2d. I saw that you do some world to camera translations and stuff like that and made me wonder if this standard approach of reducing endPosition from startPosition to get the movement vector might not work with the position you calculate and store in transform.position of game object.

So if you would tell me which positions I should use when I'm trying to do these calculations, I think that would help.


Support / Re: How to have a draggable object with 2D toolkit?
« on: February 15, 2014, 10:14:21 pm »
1. You can leave them there, or move them anywhere else. I shouldn't make any difference. I recommend not using the tk2d prefix to avoid name collisions with future tk2d classes.
2. What doesn't work? What happens? Have you tried scaling up the velocities, etc? Have you tried rigid body.MovePosition? Check the unity docs for other options.

1- Should the editor class be in a folder called Editor or it can be anywhere?

2- What I've tried so far is to store last 100 position of the object while moving it around, then calculate average of those positions in order to get a vector3 that act as velocity vector of movement and then pass it to Rigidbody.addForce, but that doesn't seem to work.

Thanks for your replies.

Support / Re: How to have a draggable object with 2D toolkit?
« on: February 15, 2014, 04:28:01 pm »
OK, finally got it working with the duplocation of those 2 files.

1- Can I move my copies of tk2dUIDragItem and tk2dUIDragItemEditor somewhere out of the tk2d directory so it'll be prone to updates of tk2d?

2- I'm trying to get the average on drag and release but can't get it to work. I've tried to get the average of current position and last position in UpdateBtnPosition and pass it to rigidbody.addForce in ButtonRelease, but it doesn't work.

Support / Re: How to have a draggable object with 2D toolkit?
« on: February 12, 2014, 04:34:06 pm »
you need to copy the editor class as well - tk2dUIDragItemEditor.cs, duplicate and change appropriately for your class.

I still cannot achieve this. Would you please help me further on this?


Thanks man. I have no idea why this happens. I tried to get away from the problem by doing some kind of hack since I'm under a lot of constraints.

I'll get back to you if I face this again.

Keep up the great work.

Pages: 1 [2] 3 4 5