• 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!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code Strange depth behaviour?

L

Leafi

Guest
EDIT: RESOLVED!

Resolved this issue by instead of setting depth in the draw event, setting it in the step event.

Hey there,

I have recently been playing around with a project that uses the old depth=-y; trick, however there is a problem.

So, to set the scene we have a player character who's depth is always depth=-y. We also have a piece of equipment whose depth is the players depth-1 (and is drawn ontop of the player).

When moving down, this causes the player to 'disappear'. He still exists, but is completely invisible when moving down, but visible when moving in any other direction. The equipment always remains visible. (The player becomes visible after no longer moving down.)

When passing through other stationary objects who upon creation depth=-y, the stationary object becomes invisible for one frame.

To make matters even more confusing, if the equipments depth is set at player.depth-3, when moving down the player becomes transparent. (again, becoming totally visible once movement has stopped.)

Even more confusinger..! Is that if the equipments depth is player.depth-10, the player no longer becomes invisible when moving down, but still makes stationary objects go invisible for a frame when passing through them (in a downwards direction).

I have absolutely no idea how to fix this problem?! Any takers who can shed some light on this?
 
Last edited by a moderator:
Top