• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Depth Control on a single layer (Object using multiple sprites at once)

R

Rim

Guest
Hi everyone!

I'm new to this community and I hope i'm posting at the right place. So let's begin.

So I've looked into the dungeon demo to understand how in GMS2 you could create a similar effect of depth -= Y of GMS1.4. The main issue is they use their own built in variable to draw every character depending on their ID and what I want to do if possible is just rearrange the instance order depending on their Y position and keeping their own draw code since I'm using multiple sprites for one object.

Their Code as follow :
/// OT_Draw()

// render everything in the Order Table (could clip to viewport here)
for(var index=0;index<global.ot_size;index++)
{
// get the list of instances for this "Y" index
var l = global.ot[# 0,index];

// IF there is anything in the list, draw it
var count = ds_list_size(l)-1;
if( count>=0 )
{
while(count>=0)
{
// Get the instance in the list
var i = ds_list_find_value(l,count--);

NEED TO REPLACE THIS ----->>>>
draw_sprite_ext( i.sprite_index, i.image_index,i.x,i.y, i.image_xscale, i.image_yscale, i.image_angle, i.image_blend, i.image_alpha );
<<<<<----- NEED TO REPLACE THIS with the current draw code of the object using his variables :/

}
// This list had something in it... so clear it! (don't clear as we still need it for silhouettes)
//ds_list_clear(l);
}
}

So my question is the following, How could I draw my characters depth that are using up to 14 sprites in a single object (They are fully animated with body parts and the code that animate them are in the end step event).

I hope I was clear enough, English ain't my main language

Thank you,
Rim
 
Top