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

Pages: [1] 2
Support / Making tk2dsprite be affected by transparent overlay
« on: October 19, 2014, 03:03:09 pm »
So I've got a tk2dsprite which has a tk2d/BlendVertexColor shader, and over it is a texture on a quad which has transparency that is basically designed to "Darken" the tk2dsprite under it as well as add some other graphical effect, currently I have it on Transparent/Diffuse shader, but no matter what shader I use the tk2dsprite is not being affected by the texture quad overlay at all.

I feel like I need to either use a different shader for the tk2dsprite or the quad, or make a small tweak to the current shaders. I have little understanding of Shaders unfortunately.

Appreciate any advice


I need to position/instantiate these dynamically on runtime though so I don't think the tilemap editor will work  for me in this case

edit: Just tested it, and the optimization does work. I still need to use the object in a non-tilemap manner though. Maybe I can just copy the edge collider it generates and just paste it into my object? This is still a lot of work as I'd have to make the objects twice (Once in the tilemap, and another just by placing them manually and batching them) Is there a better way?

I'm using tk2dStaticSpriteBatcher to batch a bunch of 'block' object into a collection of block objects. It looks like this:

As you can see, this batched sprite is comprised of many edge colliders.

Due to the way some other parts of my game works I need the object to have just 1 edge collider surrounding just the 'actual' edges of the object, like this:

I made that collider myself, as you can see it's pretty rough and takes a long time to edit manually by shift-clicking the collider vertices into place.

I realise tk2d doesn't really have any feature to do this, but I was wondering if you might be able to suggest some options I could try?


Hey, I might be having the same problem as you (http://2dtoolkit.com/forum/index.php/topic,4101.0.html)

My problem is the Z-value of the object I'm anchoring keeps getting completely messed up as I play the game

Thanks, just playing around with tk2dCameraAnchor currently. I have a GameObject parent that parents all 3 of the symbols, and put the tk2dCameraAnchor component on that object, however its Z-axis keeps getting completely messed up, at first it stays at the exact same Z position as the camera I point it to, but when I start the game the Z position gets smaller and smaller and smaller very fast.

Am I doing something wrong?

edit: Got it to work, but just as a side note: I realised when I add a tk2dCameraAnchor manually as a script component on an existing GameObject, the 'Offset' and 'To Native Bounds' option do not appear.
These options appear if I go to GameObject > Create Other > TK2D > Camera Anchor.  What is going on there?

Support / Handling GUI positioning between different resolutions
« on: May 24, 2014, 11:16:25 am »

I'm making a game for tablet/phones which means handling all sorts of different resolutions. In the game, players get 3 lives which are indicated by 3 symbols in the top left corner.

I want these life symbols to always be a set amount of distance from the top and set amount of distance from the left.

Is there a nice way to do this that will work for arbitrary resolutions? I've tried a couple of different methods including a separate camera for GUI elements only, and using camera overrides, it won't work for all resolutions. Also looked into using tk2dlayout but can't really see how it would help me.

I'd appreciate it if you could point me in the right direction



Some of my tk2dsprites constantly stop being rendered in edit mode after pressing stop during play mode in the editor - though they are still there - you can still click on it, and the collider borders appear, but the sprites are invisible. They do appear in play mode, and will reappear if I recommit the sprite collection - but they disappear again after I finish running the game.

This seems to only happen to a couple of sprites, there are other sprites in the scene from the same sprite collection that is not problematic at all.

Edit: I seem to have fixed it by deleting the sprites and readding them again, but I feel like it could happen again in the future

Any ideas what it could be?

Hey Unikron,

The above parallax sample sample thread seems to have disappeared since you posted it. Is there an updated sample?


edit: nevermind, found it! http://2dtoolkit.com/forum/index.php/topic,87.0.html

Actually, yes, I have set the x scale to 0.2. Have set this back to 1 now and seems to be working, thanks!  :)

Ok, I tried the formula you suggested:

            float newDimensionX = (transform.position - knife.transform.position).magnitude / ropeSprite.CurrentSprite.texelSize.x;
            Vector2 newDimensions = new Vector2(newDimensionX, ropeSprite.dimensions.y);
            ropeSprite.dimensions = newDimensions;

however it ends up looking like this: (The rope is not long enough. The pink line is a linerenderer I created for debugging purposes)

What do I put as the initial size for dimension.x? The sprite itself is 58x54 so I set to x=58 y=54. Does this even matter? (Trying different values doesn't seem to make a difference)

The anchor of the tiled sprite is indeed middle left.

you need to calculate the dimensions.y value that is required

Do you mean dimensions.x here? I don't see the y needs to be calculated as the y value is just the height of the sprite which in this case is 54 pixels and will stay constant. Only the length (dimensions.x) changes as it gets longer

world_distance_between_sprites / tiledSprite.CurrentSprite.texelSize.y.

'world_distance_between_sprites' Is this simply the distance between the knife and the anchor point of the tiled sprite?
And again, why is it texelSize.y?

It is already two sprites of course, the knife is its own sprite while the rope is a tiled sprite

What you've said is exactly the same as what I said except just reversed. Even if I keep the anchor of the rope on the knife I still need to extend the dimension.x value but in relation to the character instead of the knife.


I'm trying to implement a throwing knife with rope attached to it. It looks like this:

The left rope sprite is a tk2d tiled sprite, and the knife on the right is an object the character is able to throw in different directions. The anchor of the rope stays wherever the character is, but the middle handle of the other side of the rope needs to keep itself exactly where the knife's handle is at. This translates to modifying the tk2d tiled sprite dimensions.x value which is in pixel units, whereas the movement of the knife will be in Unity units (whatever it is called!)

What might I be able to do to keep these 2 points together? I feel like there is some kind of formula I can use.

Not sure if it's important, but I am using 100 pixels per meter on my tk2dcamera.

Or is there a complete other way I can implement this that is much easier?


Support / Re: How to increase size of textmesh without losing quality?
« on: February 15, 2014, 11:12:16 am »
so what you're saying is I need to just export a bigger bitmap font image using BMFont?

Support / How to increase size of textmesh without losing quality?
« on: February 15, 2014, 12:10:38 am »
I'm playing around with the demo scenes, specifically number "6 - button and 3d sprites". Trying to increase the size of the 'Spin Left' text so that for example it covers the entirety of the screen. I can increase the 'Scale' to make it bigger, however this makes the textmesh very pixelated. I've found the DemoFont prefab, and played around with its Size settings, but no matter what I do everytime it makes it big it just makes it really pixelated. How do I do this without losing quality?

Seems like a really basic thing, I'm sure it's actually really obvious..

edit: seems this has something to do with the size of the font texture file maybe?

Pages: [1] 2