Hello all,
Lately I've been working on a roguelike. I'm on 3.5.7 so I can't use the awesome free dungeon generator. Money is tight so I'm hesitant to buy map and nav.
So I've been trying to barrel through it myself.
But currently all of my tiles are drawing one atop the other in the center of the screen.
I'm using arraymaker to keep a list of tiles. Each tile has two variables, gridX and gridY.
I have a tile prefab, and a tile in the scene.
As I create tiles, I add them to the list.
I use a nest for loop to get my x and y coordinates. example
i<320 (that's an 80 x 40 playing area.)
y<80
x<40
create tile
set tile gridx to x, repeat for y.
This gets me a list of 320 tiles, each with a pair of X,Y coords.
This next part might be redundant, but I've been working on this all night and it's 6:30 AM now.
I then run back through the array, with the same loop and for each item in the array, I use Set Position to set their X to gridx and Y to gridy.
each time I do so, I offset the tile by 13(the amount of space that makes my tiles line up nicely) multiplied by the current value of f (which I used instead of i in the second for loop.
My thinking is that this should create a tidy 80x40 grid with all my tiles neatly spaced as desired.
Instead I get a pile of tile(clones) stack in the middle of the screen.
My next step is to create them all in the center and then iTween them with MoveTo to their gridx, gridy, offset at the fastest possible speed and maybe hid that behind a story panel or something.
I know other people have done this before and much better, but I don't have the cash
and it seems like this simple solution really should work right?
Thanks,
-Luke