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

Pages: [1] 2
1
Support / Strange sorting issue with my tilemaps and images in the scene.
« on: October 25, 2015, 10:17:52 am »
So it is like the tile map in my level just stopped caring about sorting layers.  I introduced this bug but I am not sure how, best guess was I was trying to get my game working on my mobile. It was not rendering the tilemap when my tiles had a sprite/diffuse on it (I wanted some simple point lights to brighten up areas of the level).     Somebody on stack over flow helped with an answer:

http://gamedev.stackexchange.com/questions/109976/unity-2d-diffuse-sprites-not-rendering-on-mobile/110120#110120

This answer (as can see above I posted in comments a lot) proved to only semi work on mobile and really messed up things that to me shouldn't of messed up.  Mostly with rendering.  I noticed things were flipped and I had to scoot backgrounds of my tilemap from -0.1 to 0.1 to get them behind the other pieces of the foreground of the level etc.   This is fine and worked, the other problem I noticed though was that now a lot of images i had in my level that were supposed to be drawn in front of the background and behind the platforms and foreground are now just being drawn in front of everything.  It is strange as I have my sorting layers all set:

Background of tilemap sorting layer is set to Background (and the zoffset is 0.1 for the background)

My foreground or where my platforms are has a sorting layer six layers above background.  My sprite images in level that are not tilemap but that I want to show up infront of background but behind platforms is set to some sorting layer after background and before Platforms.  Yet it all renders infront of the tilemap.  (Attached image).  I am going nuts trying to figure this out, it was working fine and I know it is something I did but I have no idea where to begin looking and I need to learn for the future what might of caused this.




2
Support / Wiped out snap somehow.
« on: July 20, 2015, 10:51:47 pm »
So my snap was working great with this 2dtool kit, i could lay down a level which had the tiles at 100x100 pixel size.  The c haracter (about 80pixels tall) could go through the door ways not hit head etc.  Now I wanted to switch up my physics so I got the Corgi engine from the asset store, and it imported settings must of messed up something cause now the metrics are off. the way the tiles lay down and snap its like 20 pixels to low and my head gets stuck, where can I play with these snap values to try to remedy this?


3
Ahhh thank you for that link I have done this before and I couldn't remember how!!!  Though I had something cool happen:

I had my artist deliver my tiles as individual sprites not from a sprite sheet.  creating a collection required no sprite sheet first I could just drag all the tiles in there.  Was a bit quicker than creating a sprite sheet.

I did use the multiple materials way, was changing the texture more efficient?  I wasn't sure how to do that, unless I have to do that in a separate program but it didn't seem that unity gives me any options to adjust the alpha except for a alpha from greyscale in an advanced texture type, is that what you were meaning?


4
So is the alpha on the texture I have to change it?   I was changing the material ...do I just make another sprite collection?

5
So yep the right side has atlas0 material, its been so long since I created the original sprite collection and tilemap that I forgot where atlas0 was created at. 


6
Not sure what you mean by drawing it in the same sprite collection.


This might be a dumb question but:  Can I add multiple sprite/textures to a collection or have different versions of the sprite in a collection?  I need to study up on the sprite collections all I know bout them is what was presented in order to make tile maps briefly, I never dug deep into what they can do.


7
I think I figured it out, I can goto the right tile map Chunk 0 0 for instance and goto the atlas0 material.  The shader i have as sprites diffuse but i can change the tint alpha and it works but it changes everything regardless if its a diff tile map so not sure how to stop this, create another sprite collection same image though?



8
I have no idea how to do this in unity.  Basically I have water tiles in my tile map that I want to actually render on a different layer which I can do that, but it obviously covers up anything behind it.  Instead I want it to alpha blend so it acts semi transparent.

No ideas where to start on this.  If it had a sprite renderer i could figure it out since it is a 2d game, but the way the tilemaps are built with just a mesh renderer in unity5 I am not sure how to go about doing this.



9
Support / Re: Using 2d tool kit to build a speechbubble...
« on: May 11, 2015, 06:01:02 pm »
I had one more question as I used this more.  The bounds keeps resizing my sliced sprite larger and larger.  Here is my use case:

I have different lines of text goto the speech bubble.  It displays the line of text, then the next is sent to the speech bubble.  I *WAS* in the Start method sizing the bubble, but since its now part of my speaking code, it sizes itself when a new line of text comes in so I have  a function called SizeBubble on the sliced sprite:


Code: [Select]
public void SizeBubble()
{

if(!msh)
msh = transform.Find ("TextMesh").GetComponent<tk2dTextMesh>();

Debug.Log ("Mesh: "+ msh.text + " ****" );
Bounds b = msh.GetEstimatedMeshBoundsForString(msh.text);
spr=  GetComponent<tk2dSlicedSprite>();

spr.ReshapeBounds(b.min, b.max);
}

The start code looks like this:

Code: [Select]
void Start () {

msh = transform.Find ("TextMesh").GetComponent<tk2dTextMesh>();
if(!msh)
Debug.LogError ("Coulnd't get it!");

spr=  GetComponent<tk2dSlicedSprite>();
Bounds old = spr.GetBounds();

t=target.transform;

}

The thing I am seeing is that everytime i throw a new line of text at the bubble, even if the line is shorter than the last the sliced sprite grows and never shrinks.  Above you notice I try to save the bounds in a variable called old  which i called reshapbounds on in the SizeBubble on top (took it out as it did nothing) but I think I am not understanding how ReshapeBounds works as to why my sliced sprite keeps growing and never shrinks again to match a new line of text once my talky system sends it to the speechbubble.

So any pointers as to why the sliced sprite grows and never shrinks?


10
Support / Re: Using 2d tool kit to build a speechbubble...
« on: May 07, 2015, 03:45:35 am »
yep! :) thanks for all your help.  Going to have a script that tracks player just like the camera basically.

11
Support / Re: Using 2d tool kit to build a speechbubble...
« on: May 06, 2015, 05:42:06 pm »
This seemed to work put the borders at 10.  Center middle anchored everything and wham takes any size text and grows around it and dose it well.

I attach the sliced sprite speech bubble as a child of my main player and it all works great, except when i walk the opposite direction.  To get the player sprite to face the other way i set his scale to -1 on the x. and it works, but the sliced sprite speech bubble now turns too and looks like text was in a mirror :(  not sure a way around this.

12
Support / Re: Using 2d tool kit to build a speechbubble...
« on: April 30, 2015, 09:12:09 pm »
ahhhh okay.  I did some tweaking turns out I double checked my font AND the sprite collection SETTINGS (I didn't realize I could set filter there too).  So it is crisper but still encompassing the text it grows on the borders.  I have a posted here a image with on top what its doing (with point filtering!) and on bottom something I did in gimp for what I am aiming for.


13
Support / Re: Using 2d tool kit to build a speechbubble...
« on: April 30, 2015, 06:14:17 am »
okay did that looked the same in the editor. screenshot is attached.

14
Support / Re: Using 2d tool kit to build a speechbubble...
« on: April 29, 2015, 06:24:17 am »
Ahh okay, I think I follow ya.  If I run the game then my code thats on the sliced sprite:


Code: [Select]
public class SpeechBubble : MonoBehaviour {

// Use this for initialization
tk2dTextMesh msh;
TextMesh y;
tk2dSlicedSprite spr;
void Start () {

msh = transform.Find ("TextMesh").GetComponent<tk2dTextMesh>();
if(!msh)
Debug.LogError ("Coulnd't get it!");
Bounds b = msh.GetEstimatedMeshBoundsForString(msh.text);
spr=  GetComponent<tk2dSlicedSprite>();

spr.ReshapeBounds(b.min, b.max);


}
}

Changes the dimensions from 32x32 (Which is what it is if you were to just open the file in paint for example) to 356x92 with a scale of 1.  (looks like it scales with a bilinear not a point filter mode).  Though the sprites filter mode if i just click the PNG from unity (so in the inspector) is set to point.



So thats what makes it look whacked, sounds like it is my source image but if that is the case I am not sure how to have a source image that "Grows" correctly?





15
Support / Re: Using 2d tool kit to build a speechbubble...
« on: April 28, 2015, 05:48:37 pm »
Really dumb question:  The scale in which context?  And what changes how?  Like when the bubble gets bigger to hold the text, see how that changes? 

Pages: [1] 2