ragingdemonz
Member
Hello i have a lot of tiles in my level and its fairly large stage. I was wondering how i could deactivate tiles efficiently and reactivating them when in view sorta how i deactivate objects and such. I found this in an old GM post, however... when i turned on the profile it used about 88% of step%... not to mention it seems to slow down/ lag the game up. Is there an ideal way of doing so?
Code:
///Tile activation
for (var i=0; i<tile_get_count();i++)
{
t=tile_get_id(i)
if(point_in_rectangle(tile_get_x(t),tile_get_y(t),view_xview[0]-64, view_yview[0]-64, view_xview[0]+view_wview[0]+64, view_yview[0]+view_hview[0]+64))
{
tile_set_visible(t, 1)
}
else
{
tile_set_visible(t, 0)
}
}