Clone actor for making tiles.

You must understand the Game Editor concepts, before post here.

Clone actor for making tiles.

Postby Hblade » Tue May 26, 2009 3:48 pm

Hey I tried making a tile editor of my own, because I seen other people do it, and I want to say, I dont want someone to make it for me, jsut explain how. I have the tiles perfect and all but when you press enter or something, how would you have it place that tile with that animpos? And in that exact position? If I knew that I could probably do the rest, it's just frustrating because I am not that good at C, and I know DST was trying to help all of those other times, but it was confusing so if anyone can explain how to make this, I'd apreciate it.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Clone actor for making tiles.

Postby skydereign » Tue May 26, 2009 11:16 pm

Well, when it comes to this, you could use a 2d array, as it would be an exact representation. One problem is making a single actor type to recognize the two dimensions of the array. Well, if you have a 3x3 grid, then in array subs, it looks like this
([0][0]) ([1][0]) ([2][0])
([0][1]) ([1][1]) ([2][1])
([0][2]) ([1][2]) ([2][2])
-sorry this diagram might be confusing
This is fine, as when you clone them, it follows cloneindex for the first three. So the clone needs to know which array sub it is, you will need cloneindex and use the xy gird size to find which. The 4th tile would need to be linked to [0][1]. Since the x dimension is 3, we can use its cloneindex of 3 to determine its x and y.
x would be cindex%SizeY // 3%3 ==0
y would be cindex/SizeY // 3/3 ==1

You could also use a normal array and the referencing would be done different. I use a one dimensional struct array which holds the xy, since only the clone needs to know those coordinates, for the most part, and that each clone can find its own xy as shown above. But it would be easier to use the method suggested above.

Now that you have an array that can hold values for the grid, you can use your clones xy values to access that grid, which can hold what animpos. I tried not to give away to much so you can still make it yourself, but if anything doesn't make sense or you would like further explanation, feel free to ask.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Clone actor for making tiles.

Postby Hblade » Wed May 27, 2009 5:37 am

Yeah, but you'd have to explain to me what an Array is exactly, see, I'm not noob or anything I jsut dont really know much about game editor because I didn't really used to use it much back then.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Clone actor for making tiles.

Postby skydereign » Wed May 27, 2009 6:07 am

Okay, this is a small explanation... Using related variables, you could name them vartype var1 var2 var3, or you could make an array vartype var[3]. It is just as it seems, just like cloneindex it uses 0-2 as the reference. So var1 would equate to var[0]. These are very convenient as you can use variables within the [], used commonly in for loops. Anyway, you can declare arrays of anything you want. So a 2d array would be just like your tile grid. You would be using ints or shorts as the var type, and make the two dimensions to your design.
Code: Select all
int grid[3][3]; // This declares 9 variables,(0,(0,1,2)), (1,(0,1,2)), (2,(0,1,2))
int grid[9]; // This declares 9 variables grid[0-8]
// Or you could use 9 variables incremented in name...


Essentially it is a grid of variables that are very easy to access...
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Clone actor for making tiles.

Postby Hblade » Wed May 27, 2009 3:09 pm

Thanks, skydragon.







I have the arrays, now I need to find a code to actually PLACE the tile where I set it in the tile editor.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Clone actor for making tiles.

Postby skydereign » Thu May 28, 2009 12:55 am

Well, you know the dimensions of your tiles, so you would use the same method to determine x and y and just multiply them by the dimensions. Tile [0][0], would be at (0,0), tile [1][0] would be at (60,0), and so on.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest