GameMaker [SOLVED] Place object on top of draw_sprite

Gigicom

Member
Hello,
I am trying to "put" an obj_Slot over a draw_sprite(inventory, [...]).
I am drawing the sprite of the inventory in the obj_Player which has a depth of 200. The obj_Slot has a depth of 0.
But for some reason, the sprite is still drawn over the slot and I can't find a solution for this...
I also checked the values of the two objects in the debugger, but nothing changed.
I'd be very grateful for any help
 

Slyddar

Member
Are they both drawing in a "draw" event or is one a draw_gui event? Are they on different layers and is the slot layer above the player layer in the room editor?
 

Gigicom

Member
Are they both drawing in a "draw" event or is one a draw_gui event? Are they on different layers and is the slot layer above the player layer in the room editor?
Yes, the draw_sprite(inventoy) is in a draw_gui event, the slot is just a object with a normal draw event. I use layers, but the slot layer is above the player layer.
 

FrostyCat

Redemption Seeker
Depth only determines the draw order within the same event, and things drawn in Draw GUI events always show up above things drawn in the standard Draw event.

Get the slot to pull the item from the player and proxy the draw, don't have the player do it. The player is in the wrong position on the drawing sequence to do what you want, and having it handle unrelated presentational concerns is just bad design to start with.
 

Gigicom

Member
(I know this is a really, really late response)
Thanks, didn't know that the GUI gets drawn above everything else, although now that I think about it, it makes sense.
I now simply made the Inventory Draw in a normal Draw Event in an object beneath the slot.

Thanks, for the help.
 
Top