L
Luto
Guest
hello this is my first post. i'm having troubles with a code that work slowly in android OS but it work good in Windows
the code, search a single tree tile in a 480x480px area and if found it then search 4 positions around it, and if it is surrounded by other trees then it do visible a fog tile above the center tree.
in android OS the code run slowly because of the use of the function tile_layer_find 4 times.... something weird because i made other codes more complex and they not run slowly....
my conclusion is that the tile_layer_find function is very intensive... but i don't know, i have reason? or maybe i am doing some wrong in the code?... please help
note: if you let only two code lines var x = tile_layer_find, it works good.
i have a Samsung Galaxy Ace 4, with android version 4.4.4
// in step event
var stx=0;
var sty=0;
var vxz=view_xview[0]+160; //my x GUI margen
var vyz=view_yview[0]+32; //my y GUI margen
var ts=0; //center tile shadow
var tpc=0; //center tile
var tpu=0; //upper tile
var tpr=0; //right tile
var tpd=0; //lower tile
var tpl=0; //left tile
for(stx=0;stx<512;stx+=32)
{
ts = tile_layer_find(999998,vxz+stx,vyz+sty);
tpc = tile_layer_find(1000000,vxz+stx,vyz+sty);
tpu = tile_layer_find(1000000,vxz+stx,vyz+sty-32);
tpr = tile_layer_find(1000000,vxz+stx+32,vyz+sty);
tpd = tile_layer_find(1000000,vxz+stx,vyz+sty+32);
tpl = tile_layer_find(1000000,vxz+stx-32,vyz+sty);
if (ts != -1) && (tpc != -1) && (tpu != -1) && (tpr != -1) && (tpd != -1) && (tpl != -1) // if exists tiles
{
if ((tile_get_left(tpc)==0) && (tile_get_top(tpc)==416)) && ((tile_get_left(tpu)==0) && (tile_get_top(tpu)==416))
&& ((tile_get_left(tpr)==0) && (tile_get_top(tpr)==416)) && ((tile_get_left(tpd)==0) && (tile_get_top(tpd)==416))
&& ((tile_get_left(tpl)==0) && (tile_get_top(tpl)==416)) // if the tile center is a tree and if it is surrounded by other trees
{
tile_set_visible(ts,true);
}
}
if stx==480 && !(sty==480) {sty+=32;stx=0;} // to search the next lower row from left to right
}
the code, search a single tree tile in a 480x480px area and if found it then search 4 positions around it, and if it is surrounded by other trees then it do visible a fog tile above the center tree.
in android OS the code run slowly because of the use of the function tile_layer_find 4 times.... something weird because i made other codes more complex and they not run slowly....
my conclusion is that the tile_layer_find function is very intensive... but i don't know, i have reason? or maybe i am doing some wrong in the code?... please help
note: if you let only two code lines var x = tile_layer_find, it works good.
i have a Samsung Galaxy Ace 4, with android version 4.4.4
// in step event
var stx=0;
var sty=0;
var vxz=view_xview[0]+160; //my x GUI margen
var vyz=view_yview[0]+32; //my y GUI margen
var ts=0; //center tile shadow
var tpc=0; //center tile
var tpu=0; //upper tile
var tpr=0; //right tile
var tpd=0; //lower tile
var tpl=0; //left tile
for(stx=0;stx<512;stx+=32)
{
ts = tile_layer_find(999998,vxz+stx,vyz+sty);
tpc = tile_layer_find(1000000,vxz+stx,vyz+sty);
tpu = tile_layer_find(1000000,vxz+stx,vyz+sty-32);
tpr = tile_layer_find(1000000,vxz+stx+32,vyz+sty);
tpd = tile_layer_find(1000000,vxz+stx,vyz+sty+32);
tpl = tile_layer_find(1000000,vxz+stx-32,vyz+sty);
if (ts != -1) && (tpc != -1) && (tpu != -1) && (tpr != -1) && (tpd != -1) && (tpl != -1) // if exists tiles
{
if ((tile_get_left(tpc)==0) && (tile_get_top(tpc)==416)) && ((tile_get_left(tpu)==0) && (tile_get_top(tpu)==416))
&& ((tile_get_left(tpr)==0) && (tile_get_top(tpr)==416)) && ((tile_get_left(tpd)==0) && (tile_get_top(tpd)==416))
&& ((tile_get_left(tpl)==0) && (tile_get_top(tpl)==416)) // if the tile center is a tree and if it is surrounded by other trees
{
tile_set_visible(ts,true);
}
}
if stx==480 && !(sty==480) {sty+=32;stx=0;} // to search the next lower row from left to right
}