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

Pages: [1] 2
1
Support / Re: alpha animation
« on: September 07, 2012, 04:22:33 pm »
I believe what dotty says is right, after you've made changes in the code, you need to do a .Commit() for it to actually change. Same goes if you change the text.

2
Support / Re: Sprite HitTest with Screen point.
« on: August 30, 2012, 11:52:39 am »
Why would you want to do it without a collider? A Collider as trigger is the most optimized thing you can have in unity. You can't build a solution that's more effective than that one.

And what you want to do is convert the sprites position to screen position, because the world (0,0,0) isn't in the top left of your display, and compare the bounds of the sprite to your input position, to check if it's inside.

Else you can Just add a tk2DButton component to your sprite, for simple click behaviour.


edit: I believe The colliders use algorithms far more advanced and optimized than basic checks
Code: [Select]
if (Input.x > position.x && Input.x < position.x + bounds.x){}


3
Support / Re: TileMap Layer offset
« on: August 25, 2012, 04:48:57 pm »
Thanks MooNizz for replying to these posts while I was away! Appreciate it.

Don't worry, I like helping out. So if I am able to do it, I will. :)
Got to find some time to the editor stuff and I'll mod tk2d for my own purposes. And help others on the forum :)
I love your work unikron! It will hopefully make me rich ;)

4
Support / Re: TileMap Layer offset
« on: August 24, 2012, 09:48:25 am »
I haven't looked up any editor coding yet, therefore i couldn't provide you with a solid dynamic way of doing it.
But I'm glad it works the way you wanted :)

Just remember that if you upgrade the 2D Toolkit, your code will be overwritten so you'll have to add it again.

5
Support / Re: TileMap Layer offset
« on: August 23, 2012, 11:03:31 pm »
Check my code in the previous post as this do exactly as you want it to do, each added layer will put the tiles with an offset of 10 pixels,

Add this on line 285 in tk2dTileMapBuilderUtil.cs
Code: [Select]
tilePosition.y += layerid * 0.016f; // this is 16 pixels offset works for 32x32 tiles, take half the value of the tilemap pieces, if they're 64x64, add change the value to 0.032f and it should be fine.

if you only want one of the layers to do this, and not every layer >= 1, just put an if check
Code: [Select]
if (layerid == 1){
tilePosition.y += layerid * 0.016f; // this is 16 pixels offset works for 32x32 tiles, take half the value of the tilemap pieces, if they're 64x64, add change the value to 0.032f and it should be fine.
}

6
Support / Re: TileMap Layer offset
« on: August 23, 2012, 09:18:12 pm »
I've worked quite a bit with the tilemap, I see no reason why one would like to offset the layer in the y-axis, with the layer option you can move them in the Z axis and use each layer as "background" "foreground" etc,
you don't have to paint all tiles in a layer. Just skip the lowest part and start on row 2 if you want them to start higher up.

Please provide a picture since i cannot understand a possible scenario for this behaviour that could not be created using the current creation

edit: Some weeks ago i edited the Z-row for each row in each layer at buildtime, you could probably look at this and redefine it for your purpose. http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,447.0.html

edit2: Since i was curios about how i would do this i fixed it, right below line 285 in tk2dTileMapbuilderUtil.cs i added a y-value change
Code: [Select]
tilePosition.z += z;
tilePosition.y += layerid * 0.01f; // <-- added this, and each layers go up a bit higher. modify for your purpose :D

7
Support / Re: flip
« on: August 22, 2012, 11:40:36 pm »
That is not the sprite scale.
You're using the Transform.Scale, when you should be using the sprite.scale, look at attached picture

8
Support / Re: Painting irregular size tiles with the tilemap.
« on: August 16, 2012, 08:57:14 am »
An already hand made tile set map? You mean a spritesheet? That's possible with tk2d

9
Support / Re: Painting irregular size tiles with the tilemap.
« on: August 15, 2012, 07:54:30 pm »
Still, it's not really made for irregular sized sprites. check image below
And one shouldn't, if you aim to actually work with this as a profession you would be turned down immediately if you used irregular sized images in a tilemap.



10
Support / Re: Painting irregular size tiles with the tilemap.
« on: August 15, 2012, 11:33:20 am »
Still, best practice is to never use irregular sized sprites for a tilemap. And Uni-tile probably do the exact same thing I explained, just automatically. The rest of the functionality is in the 2d Tool Kit.

11
Support / Re: Painting irregular size tiles with the tilemap.
« on: August 15, 2012, 11:08:33 am »
A tilemap should never use irregular sprites. That's a no-no.
You should split the 128x256 up in 2 tiles instead.
Import the image as a spritesheet and define it as 128x128 in the collection editor, and you'll get 2 sprites out of it.

12
Support / Re: Draggable sprite/button?
« on: August 14, 2012, 03:09:01 pm »
I don't think this is achievable with the tk2dButton, I would just make a sprite with a collider, give it a "button"-tag or something, and using a raycast against it and check if the  left mouse button is pressed, and if it is just move the buttons transform to mouse pointer.


Something like (this is by mouse, but you know how to change it I hope :) )
Code: [Select]

void Update(){

CheckButtonInput();

        if (buttonObject != null)
buttonObject.transform.position = Input.mousePosition;
}


void CheckButtonInput(){

if (Input.GetMouseButtonDown(0)) {
    Ray ray = camera.ScreenPointToRay (Input.mousePosition);
    if (Physics.Raycast(ray, out hit, 1000)){
    if (hit.collider.tag == "button"){
buttonObject = hit.collider.gameobject;
} else {
buttonObject = null;
}
    }
}

if (Input.GetMouseButtonUp(0)){
buttonObject = null;
}
}

Something like that would prolly work, haven't tried it :D I hope you get the idea.

13
You could use the Polygon Option in the sprite collection to define the collision areas yourself. That's what i do :)

Edit: I only use it for buttons so there aren't many sprites for me to do it for. Still, it would be faster doing it that way than colorchecking the atlas.
So if you still want a general solution for colorchecking, you can get the textureCoord information from a raycast hit info~.

14
Support / Re: A Way to Combine Sprite Collections?
« on: August 13, 2012, 12:28:36 am »
as long as it lowers the drawcalls into a single one, I'm happy :)

15
Support / Re: A Way to Combine Sprite Collections?
« on: August 12, 2012, 04:11:18 am »
This would be really useful for structuring my sprites in different collections and combining them _before_ runtime (in the editor, extra loading time is a pain in the buttocks),
else if option is made possible to sort the order of collections added. A code example would be appreciated.
(I got no animations but tons of smaller sprites that i need to keep track of with alot of collections)

Pages: [1] 2