• 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!

How to change sprite depths for character to move around an object?

H

hydr0

Guest


I have my player with a mask around his feet (that way his feet check for collisions, allowing his head to poke through). However, since the object has a front and back, I would like for my sprite to go behind without walking down through the planters, and get in front of the planters too. The planters are set at 0 depth, while my character is set at 1 depth. Any help with this is appreciated!
 
U

Ungrateful Dead

Guest
Assuming the planter is an object and not tiles, what I usually do for this is set the depth to -y at the step or create event for each object in the scene, depending of course on whether the object is actually moving or if its stationary like your planter. That should make it so that when your player is below the y origin of the planter he appears in front and when he's above he'll appear in back.
 
J

joqlepecheur

Guest
F1 is your friend :)
depth = -y;

As Ungrateful Dead is saying, make sure to always put size of the sprite as the origin (100 for 100 height sprite etc) or if you are lazy put depth = -y -sprite_height in create event
 
Top