GMS 2 Sprite having multiple depth?



Let's say my game have a desk with a chair, and a character. I want character to come to the desk, sit on the chair and rest his hands on top of the desk.

The problem is that his legs should become covered by the desk, while his hands should be covering parts of the table.
I can make one sprite to be completely in front or behind another one, not part of it behaving a different way.

How can I do this properly? Somehow delete character sprite and draw him to the actual desk sprite without legs, and then later make character appear in the correct place when he gets up?

Here is an example picture


Forum Staff
Draw two parts of the sprite - one below, one above the table - for example, using a controller object which draws all three involved sprites, in the correct order. Alternatively, if you're using GM:S 2, you could also use sprites in combination with layers instead of a controller object.