#Issue with mirrored player

1 messages · Page 1 of 1 (latest)

gaunt mantle
#

Hi! I am trying to create a platformer, where the screen is divided in the middle horizontally, and the player is projected on both sides. Tha controls move both "players" (the one in the real world and the one in the mirror world). I have gotten them to move with the same inputs basically like a mirror, but the physics don't really work. When the "real" player is on a platform, the mirror player stays floating (this is goood). But when I want to use a platform in the mirror world, the real player keeps falling and the mirror player is pulled through the platform. I would like help to have them both "float" if the other is on a platform.

ionic briar
#

What's the code for the player?

gaunt mantle
#

It's the one that comes with the CharacterBody2D

ionic briar
#

So you didn't change it?

gaunt mantle
#

I tried using a global script to keep track of values like gravity and position, but I ended up in a worse spot, so I returned to the main one for now

ionic briar
#

What if you just made the two players part of one characterbody2d

#

You can add multiple collision shapes to a characterbody2d

gaunt mantle
#

Ohhhh interesting idea, but wouldn't they follow the same physics tho? My other character is supposed to mirror so like, gravity would be inverted

ionic briar
#

Oh okay then we need another solution

#

Uhhh the two worlds are actually both the same way down but you just flip the mirror world upside down with a shader so it looks like gravity is reversed

gaunt mantle
#

I am actually just flipping the sprites 180° from the tile set, and they are all in the same place. It's just my "mirror" character which is flipped and "following" the real one

ionic briar
#

If you flip the graphics while the mirror level is actually right side up, then you don't have to worry about two different gravities

#

Alternately, you can just put all the mirror platforms on the non mirror level, but invisible

#

And the mirror player has no collision and just follows the normal player

gaunt mantle
#

How did it never occurred

#

I'm so cooked thankssss!

ionic briar
#

Nah you're fine

gaunt mantle
#

Ok so I'll just "solve" this and tell everyone ure smart ok thankss