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

Pages: [1]
1
Support / Re: Get an array of Sprite pixel colors?
« on: March 22, 2015, 06:37:12 am »
Thanks a lot. I'll check that out. Sorry for all the questions.

2
Support / Re: Get an array of Sprite pixel colors?
« on: March 19, 2015, 12:41:45 am »
I had another try at this, but still need some direction I think.

http://pastebin.com/6qZi4Un7

When you have the time, please help me correct this to how it should be working. I think the logic should be down for getting the color data for a subsection of an image of the same or larger size, but still confused about the issues above (pretty sure I'm getting the wrong larger image and don't know how to line up spriteIds with this data I'm grabbing). I currently have this after the "save changes" section

3
Support / Re: Get an array of Sprite pixel colors?
« on: March 18, 2015, 06:07:00 pm »
I've looked around some more but don't totally understand how SpriteLut is working/which data structures if any correspond 1:1 to sprites.

So here's my thoughts/questions:

Each texture in the textureList can have one or more SpriteLut objects referring to it.  The SpriteLuts have the rx, ry (origin of upper left of an image?) and rw, rh (width and height away from that origin?)  in case one image like a sprite sheet is split into multiple sprites.  Even if I loop through each Texture2D in the textureList, how will I know which sprite they correspond to by name or spriteId?

Once I know how to get which sprites are related to which textures in the textureList, it shouldn't be too hard to make a new flattened array from parts of the GetPixels() return value,  and then as long as I put the array itself in the right place I should be able to access it in my scripts.

4
Support / Re: Get an array of Sprite pixel colors?
« on: March 17, 2015, 05:04:56 pm »
Okay, I will add a flattened array into tk2dSpriteDefinition.

The [,] was more for my own convenience so that I would have to do the modular/int division for every pixel when accessing it.  So for each texture2d there will potentially be more than one image? I will have to look at SpriteLut  to see what's going on with that.

So would this code go at the end of Rebuild(), after all the existing code? And how would I access and overwrite the pixel color map for each sprite from the Rebuild() method, like is there a list of sprite definitions that I should modify, and am I right to be changing values of currentBuild?

Thanks a lot.

5
Support / Re: Get an array of Sprite pixel colors?
« on: March 17, 2015, 02:49:52 am »
Hi,

So I have a naive attempt at doing this, but I was wondering if you could give me some guidance on where to put these changes.

I have a Color[][,] added to tk2dSpriteCollection.cs (should it be in tk2dSpriteCollectionData?) called pixelColorMaps

Then in Rebuild() in tk2dSpriteCollectionBuilder I have this written out to  try to populate those color maps.
http://pastebin.com/UiEeAPgp

I'm guessing referring to and changing currentBuild is not what I'm supposed to be doing, but I feel like if I can define the Color[][,] variable in the right place and put the above code in the right place, and modify the correct instance I might have what I need

6
Support / Re: Get an array of Sprite pixel colors?
« on: March 13, 2015, 01:45:16 am »
Hmm okay. I might look into that but not sure I'll be able to pull that off. Thanks!

7
Support / Get an array of Sprite pixel colors?
« on: March 12, 2015, 07:31:49 pm »
Hi,

I was just wondering if there is a way I can get an array of the pixels of a tk2dSprite, whether the array is 2D or just one long flattened array. I don't need to modify the colors, but I'd like to write some effects for my game that, for instance,  instantiates a particle of the average color of each 2x2 block of pixels or something in order to do vaporization or teleportation effects or something. Can I do this?

Thanks

8
Support / Re: Sizing sprites to align with 1 'unity unit'
« on: March 08, 2014, 06:52:29 pm »
Thanks a lot. For some reason  I missed that option.

9
Support / Sizing sprites to align with 1 'unity unit'
« on: March 07, 2014, 08:42:42 pm »
Hi,

I'm starting a new project and trying to set it up to make the code simpler. It's going to be a puzzle game with a grid system, and I'd really like it if I could find a way to line up square sprites to take up 1x1 units of length. I know it'll be a combination of setting the ortho size of a sprite collection and the pixel size of the original sprite files, but I'm not sure how I can easily line the two up. Is there some kind of formula/principle that tells me how to do this?


Pages: [1]