How do I z-order a jumping character in a beat'em up?

Get help using Construct 2

Post » Mon Aug 28, 2017 1:48 pm

Hello! I'm making a beat'em up game using 8 direction. I had to find a way to organize the objects's z orders based on their Y position, and the simplest way to do that was with the plugin Rex Z sorter, like this:

Image

And it worked! The character's and enemies' position is just like it should be!
Image

Except... when the character jumps
Image

Image

The character's z order change, he should be in front of the enemy closer to him but is now behind him, and it makes sense. When he jumps he changes his Y position.
I tried applying a condition to that every tick I showed above that only changes z orders if the character is not jumping. But that would make enemies go over each other without changing z orders every time the character jumped.

Will I have to find another way to do this? Or does anyone know how to get around the z sorter plugin and make the character keep his z order when he jumps?

Thanks!
B
22
S
7
Posts: 25
Reputation: 1,496

Post » Mon Aug 28, 2017 3:28 pm

maybe using a helper container sprite staying on 'the ground position' for z-order?
Image Image Image
B
43
S
22
G
15
Posts: 391
Reputation: 12,278

Post » Mon Aug 28, 2017 4:32 pm

mercuryus wrote:maybe using a helper container sprite staying on 'the ground position' for z-order?


I tried that already :/. I made an object that follows the player around, stuck to his foot, when he is not jumping. When he is jumping, I tried setting the player's z order to this object's z order

Image

And this happened, every time I jumped an enemy above me vanished!

Image

Debugging the project I saw that the enemy wasn't set to Invisible. It misteriously vanished.

This probably happens because I'm telling to always set the object's z index based on their position, and asking once for the player to not do that bugs the plugin.

Do you perhaps have a suggestion on how to make this system without using the plugin, or another suggestion on how to try and change only the player's z order when jumping? Thanks!
B
22
S
7
Posts: 25
Reputation: 1,496

Post » Tue Aug 29, 2017 12:55 pm

Quick thought, move your current event "Sort all objects" to under a condition of Player != Jumping
Then, under an else condition, run the event "Sort all objects" but for everything except that player.
I haven't used this particular plugin so I don't know if you could do that. But maybe a family would work? Just sort the objects in the family?
Image
Keeghan McGarry | Managing Director
Facebook-Website
B
17
S
3
Posts: 89
Reputation: 1,220

Post » Tue Aug 29, 2017 5:28 pm

KeeghanM wrote:Quick thought, move your current event "Sort all objects" to under a condition of Player != Jumping
Then, under an else condition, run the event "Sort all objects" but for everything except that player.
I haven't used this particular plugin so I don't know if you could do that. But maybe a family would work? Just sort the objects in the family?


That would definitely work, but unfortunately I can't make exceptions (not that I know). Maybe there's an advanced way of making exceptions with this plugin, but then it would take its simplicity away. I'll try to do that using families and not the plugin
B
22
S
7
Posts: 25
Reputation: 1,496

Post » Tue Aug 29, 2017 5:35 pm

@marcosfl I have the same assets there Brilliant!
Image
B
45
S
23
G
13
Posts: 357
Reputation: 11,645

Post » Thu Aug 31, 2017 8:36 pm

LaurenceBedford wrote:@marcosfl I have the same assets there Brilliant!


Great assets, aren't they? Haha!

Thank you all for your replies, I managed to do it using families
B
22
S
7
Posts: 25
Reputation: 1,496


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 4 guests