So I’ve got these two arrays, shown here:
[php]// This is my world map, the numbers represent certain tiles, i.e 1=>“stone_floor” and 2=>“wood_floor”.
// The values in this array are preset, so there’s no problem here.
$world_map = Array(
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 2, 2, 2, 2, 1, 1,
1, 1, 2, 2, 2, 2, 1, 1,
1, 1, 2, 2, 2, 2, 1, 1,
1, 1, 2, 2, 2, 2, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1);
// My problem is here. (continued below)
$tile_map = Array();
[/php]
I want $tile_map to only pull the 2s from $world_map, to become a 4x4 map, instead of the original 8x8.
However, my problem is that I want to sometimes move that 4x4 box to the right/left and up/down, to include some of the 1s.
I’ve tried for days to find a way to do this, and I just cant figure it out. Any and all help would be appreciated.