ENIGMA Forums

Outsourcing saves money => Programming Help => Topic started by: crxtrdude on January 07, 2016, 09:48:40 pm

Title: changing depth of instances.
Post by: crxtrdude on January 07, 2016, 09:48:40 pm
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?
Title: Re: changing depth of instances.
Post by: TheExDeus on January 08, 2016, 01:18:51 pm
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.
Title: Re: changing depth of instances.
Post by: crxtrdude on January 08, 2016, 10:45:56 pm
Oh yeah, i forgot to place screens. Here:

(http://i.imgur.com/SGowvEz.png)

Direct comparison:

(http://i.imgur.com/axXuKNe.png)

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

(http://i.imgur.com/tibtuga.png)

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

(http://i.imgur.com/EKX3UgH.png)
Title: Re: changing depth of instances.
Post by: TheExDeus on January 10, 2016, 09:57:39 am
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.
Title: Re: changing depth of instances.
Post by: crxtrdude on January 10, 2016, 10:26:28 am
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 (https://www.dropbox.com/s/e8rs8hhna2f5cha/parkour_min.egm?dl=0)

This bare minimal build contains a fix in obj_player.