Divinik
Member
I have a depth system based off of FriendlyCosmonaut's tutorial, and my implementation of it was working perfectly until the newest GMS2 update.
So every object affected by the system is a child of the object par_depthObject.
Here is the code for the depth handler object
And here is the code for the objects affected by the grid:
It works perfectly accept that when battle mode is active, a single enemy does not display properly. I was debugging and noticed that the depth does change depending on the y position for the object, but it isn't drawn to show the change. Any ideas why this is happening? Thanks again.
So every object affected by the system is a child of the object par_depthObject.
Here is the code for the depth handler object
Code:
var dgrid = object_depthGrid;
var inst_num = instance_number(par_depthObject);
var yy = 0;
var in_combat = 1;
ds_grid_resize(dgrid, 2, inst_num);
if battle_mode = false
{
with (par_depthObject)
{
dgrid[# 0, yy] = id;
dgrid[# 1, yy] = y;
yy++;
}
}
else
{
with obj_testEnemy
{
if in_battle = true {in_combat++};
}
if instance_exists(obj_testCompanion) {in_combat++};
if instance_exists(obj_testCompanion2) {in_combat++};
if instance_exists(obj_testCompanion3) {in_combat++};
if instance_exists(obj_testCompanion4) {in_combat++};
ds_grid_resize(dgrid, 2, in_combat);
with character_inUse
{
dgrid[# 0, yy] = id;
dgrid[# 1, yy] = y;
yy++;
}
if instance_exists(obj_testCompanion)
{
with obj_testCompanion
{
dgrid[# 0, yy] = id;
dgrid[# 1, yy] = y;
yy++;
}
}
if instance_exists(obj_testCompanion2)
{
with obj_testCompanion2
{
dgrid[# 0, yy] = id;
dgrid[# 1, yy] = y;
yy++;
}
}
if instance_exists(obj_testCompanion3)
{
with obj_testCompanion3
{
dgrid[# 0, yy] = id;
dgrid[# 1, yy] = y;
yy++;
}
}
if instance_exists(obj_testCompanion4)
{
with obj_testCompanion4
{
dgrid[# 0, yy] = id;
dgrid[# 1, yy] = y;
yy++;
}
}
with obj_testEnemy
{
if in_battle = true
{
dgrid[# 0, yy] = id;
dgrid[# 1, yy] = y;
yy++;
}
}
}
//Sort Rows
ds_grid_sort(dgrid, 1, true);
Code:
var depth_grid = depth_controller.object_depthGrid;
if battle_mode = false
{
for (i = 0; i < ds_grid_height(depth_grid); i++)
{
if depth_grid[# 0, i] = id
{
depth = -250-i;
}
}
}
else
{
for (i = 0; i < ds_grid_height(depth_grid); i++)
{
if depth_grid[# 0, i] = id
{
depth = transition_controller.depth-150-(i*5);
}
}
}