Pages: 1
  Print  
Author Topic: changing depth of instances.  (Read 7408 times)
Offline (Unknown gender) crxtrdude
Posted on: January 07, 2016, 09:48:40 pm
Member
Joined: Dec 2015
Posts: 22

View Profile WWW
Hey, I've been on the works on a Freerunning platformer based on an old game maker game, with newer cleaner code and new moves.

I've almost finished the meat of my code, but I've hit a snag. The blocks I used are similar to the 1980s Prince of Persia, so they have this 3D look to them. As such, when the player hits the wall to the left, the player should be behind the wall and the opposite, player should be in front.

Now, I'm struggling to do something like that. I use sprites instead of backgrounds, since I will be designing the game along with a map maker.

Is there a way to do so without messing up the entire level depth? I've been experimenting with the blocks in the level, checking if the player's y was greater than the y of the block, but it messed up the levels. Maybe using the player would do such?
« Last Edit: January 07, 2016, 09:50:35 pm by crxtrdude » Logged
Offline (Unknown gender) TheExDeus
Reply #1 Posted on: January 08, 2016, 01:18:51 pm

Developer
Joined: Apr 2008
Posts: 1860

View Profile
What is drawing the sprites? If it is an objects (like obj_wall), then you can set depth for that.
If you use tiles (that would imply backgrounds though) you could change depth for them too. Background tiles can be drawn at any depth just like when using instances so they would render correctly.
I don't know how your sprites look like (or how large they are) so it is harder for me to tell what would be messing up. I think you should just put foreground and ground in front of the player and background and walls (left and right) behind it.
Logged
Offline (Unknown gender) crxtrdude
Reply #2 Posted on: January 08, 2016, 10:45:56 pm
Member
Joined: Dec 2015
Posts: 22

View Profile WWW
Oh yeah, i forgot to place screens. Here:



Direct comparison:



My current fix (check if player collides to the right, then put her behind).



Here's basically its collision bounds (the dotted line). Sprite is from my map editor.

« Last Edit: January 08, 2016, 10:48:34 pm by crxtrdude » Logged
Offline (Unknown gender) TheExDeus
Reply #3 Posted on: January 10, 2016, 09:57:39 am

Developer
Joined: Apr 2008
Posts: 1860

View Profile
But are they drawn as sprites? And what draws them? One controller object which has an array to draw or is it one object instance per sprite? Because I think you should just change the depth of that block, not the character. The character must be at the same depth all the time and only change the surrounding world.
Logged
Offline (Unknown gender) crxtrdude
Reply #4 Posted on: January 10, 2016, 10:26:28 am
Member
Joined: Dec 2015
Posts: 22

View Profile WWW
It's drawn as sprites per object instance.

In fact, to make it easier on the both of us (and for people who want to check out the code), I'll just give you a sample of the game.

parkour_min.egm - Dropbox

This bare minimal build contains a fix in obj_player.
Logged
Pages: 1
  Print