Information
By: panzercretin
Asked: October 09, 2011
Answered: December 31, 1969
Worth: 10 Member Points
Question answered:
The member points were handed out this way:

SpectreNectar (19)
Randomizing tiles per layer

This may or not be for the competition. (shhhhh...)

So, say I had three layers of tiles, which pile up in a certain order (let's just say, as a random example, grass - dirt - bedrock). How can I make it so that every instance of a tile in a certain layer is randomized from a specific palette, which consists of different shapes of the same thing, so as to avoid monotony?


Dev - Warning
Dev - After editing rating, make rating display change
Dev - When editing, update "edited" column
Dev - Restore deleted comments
Dev - Display deleted comments if mod (hidden, then with dropdown)
Dev - After deletion or during edit, make rating dropdown appear again
Dev - Stricter rating rules. Prevent user from rating again
Dev - Pages
Dev - Reporting
Store the tile indexes of your tilesets in an array for each and run through the tile layers on start up changing the indexes to the new ones?

tile_layer_find(depth,x,y)
tile_set_region(id,left,top,width,height)
Posted by SpectreNectar October 09, 2011 12:43 - 1.6 years ago
| [#1]

Could you elaborate that a bit more? Would I be placing the tiles in code, or in the room editor? Also, how would I assign the tile indexes, exactly? Would I have to hand-code each tile placement?
Posted by panzercretin October 09, 2011 12:45 - 1.6 years ago
| [#2]

You'd place them normally in the editor. Just make sure they all align with the grid (whatever their size are) and do something like this in the create event of some object:

Code
var tileindex_x, tileindex_y, tileindexes;
tileindex_x[0] = 64; //change these to the actual indexes
tileindex_y[0] = 64;
tileindex_x[1] = 96;
tileindex_y[1] = 64;
tileindexes = 2;


var layer, layers;
layer[0] =  99998; //change these to the actual depths
layer[1] =  99999;
layer[2] = 100000;
layers = 3;

var it, r;
var c, r, l;
for( l=0; l<layers; l+=1 ) {
for( r=0; r<room_height+HEIGHT; r+=HEIGHT ) {
for( c=0; c<room_width+WIDTH; c+=WIDTH ) {
it = tile_layer_find(layer[l], c, r);
r = floor(rand(tileindexes));
if(it>=0) tile_set_region(it,tileindex_x[r],tileindex_y[r],WIDTH,HEIGHT);
}
}
}
(WIDTH and HEIGHT are whatever you want them to be)
(haven't tested for typos)
Posted by SpectreNectar October 09, 2011 12:55 - 1.6 years ago
| [#3]

All right, thanks mate. That could work in room initiation too, right?
Posted by panzercretin October 09, 2011 13:02 - 1.6 years ago
| [#4]

No problem :)

I should think it would work there too yes. But then you couldn't save it and reuse the vals for other rooms (if you need that).

Looking forward to see what you make of it :)
Posted by SpectreNectar October 09, 2011 13:03 - 1.6 years ago
| [#5]

Can I has MP ? :o
Posted by SpectreNectar October 10, 2011 18:00 - 1.6 years ago
| [#6]

Recent Activity
 
Active Users (0)