Creating a mirror image of the player

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • No not a mirror that you can look into to see the player.

    I've got an active that is my mirror, when the player jumps or walks through it I want to create a doppelgänger that moves when I move but in the opposite direction.

    In the image below I've got a static active duplicate of the player, I've not yet added any conditions to get it moving because I'm not sure how. I used David Newton's platform engine tutorial to build my game around. The darker grey player on the right needs to move in tandem with the real player on the left, jumping when I jump etc. As it's a mirror image it needs to walk right when I walk left and vice versa.

    For those of a certain age (like me) may recall the original Prince of Persia on the Amiga computer. That's the effect I'm going for.

    Please login to see this link.

  • This might make things clearer. I stitched it together quickly so it's a bit rough.

    Please login to see this link.

    As well as that I have,

    Collision between FAKE PLAYER and MIRROR active ---> Create Doppelgänger at (0,0) from FAKE PLAYER and Set position at (-10, 15) from PLAYER. Run event ONCE.

    So what happens is as I touch the mirror or pass through it the doppelgänger is created on the opposite side of the mirror and faces in the opposite direction as it should. while it's animation is the same as the player it doesn't move and has no gravity.

  • I'm beginning to think this just isn't possible in MMF2.

    I changed tack and duplicated ALL the movement conditions and events for a new player active, detector and sprite (fake player) - copied down the T.
    Put that lot in a new group and deactivated it on start of frame.

    Then when the real player hits the active that is the mirror the doppelgänger is created next to the player and the group is activated.

    The doppelgänger follows the players movements, but with directions mirrored (I move left the doppelgänger moves right) and it has gravity.

    However as I continue to move about the doppelgänger goes out of sync and we're no longer mirrored to the point where both players are in different parts of the frame and gravity starts to have a strange effect on either me the real player or the doppelgänger floating to the ground slowly. We can re-sync by moving into the far corners either side of the frame. If I tap quickly the left or right cursor keys the doppelgänger can't match my movements and our positions go out of sync again.

    Any one got any ideas?

  • Please login to see this attachment. Here's a test level using David Newton's platform engine. Walk or jump through the "mirror" and the doppelgänger appears. It should move with the player mirroring each move but as you can see after a while of jumping around the doppelgänger goes out of sync. Especially noticeable if you tap left or right very quickly.

  • To think about this a different way, instead of trying to make the mirror image duplicate the movements backwards, you could try to work out what coordinates to place it at instead.

    If you try something like this it might work, but note, only for perfectly symmetrical levels.

    - Always set the mirror image animation direction to the opposite of the player.

    - Always set the Y coordinate of the mirror image to the same as the player.

    - Always set the X coordinate to the opposite side of the screen of the player... If your screen is 640 pixels wide this would be to: 640 - X("player")

    It's a fun way of doing it because you don't need to worry about calculating gravity or whatever at all! It just copies the position of the player exactly.

    I've not tested this but I think the principle should work!

    SUPER MEGA BEST CAT ADVENTURES Please login to see this link. and Please login to see this link. live now!

  • How about using the Platform Movement Object by Olle Fredriksson? You could use two of them for the two players, and set them so that one reads the left key as 'left' and the other as 'right'. Same for the right key.

  • Thanks PBarwick, and sorry for late reply - this post got pushed down the list and other things I've doing got in the way.

    The above doesn't work because my frame is not 640x480. The actual game window is but my frame is 6400x4800, split into a grid of rooms that are 640x480. I use actives to change scrolling centre frame in widow commands when the player moves from one room to another ("flick-screen" not scrolling).

    Anyway I tried the code above and the mirror player is nowhere to be seen (could be anywhere).

    EDIT

    Maybe this will makes things clearer:
    Please login to see this link.

    The room with the "mirror" is the first one from the right on the top row. The room in the very top left corner is 640x480 (measured from bottom right corner of it). The mirror room is at 5760x960 (with centre point being 5440x720).

    If I put:

    Set X position (of doppelgänger) to 5760-X("player")

    the doppelgänger doesn't appear when the payer collides with the mirror.

    This is the mirror room:
    Please login to see this link.

    The player collides with the mirror (one time activation) the doppelgänger appears and should mirror the players movements.
    The doppelgänger can pass through the glass covering the way down on the left so the player moves to the right side of the room opposite from where they came in on the left and goes down to the bars, pressing Spacebar on levers opens door so you can do that here with the doppelgänger actually using the lever to remove the bars. Then the player and doppelgänger can drop down to the room below.

    The red thing in the top right will kill the player and is to prevent the player from leaving the room on the left and buggering up the system (because leaving will cause the doppelgänger to hit it and kill the player).

    Edited once, last by soopytwist (July 23, 2015 at 4:59 PM).

  • Well, there's a peculiar thing.

    I set the X condition to: Set X position (of doppelgänger) to 10880-X (of player).

    Touching the mirror puts makes the doppelgänger appear right in front of the player, on the other side of the mirror and perfectly in-sync!

    I'm not even sure how I came up with this, I'm hopeless at maths. I started with 5440, the centre X coordinate of the mirror room and had a condition set up when pressing 3 on the keyboard to centre the frame at the doppelgänger and found him way over on the left side of the frame at roughly 320x720. Setting the X to 6080, the room that is to the right of the mirror room set the doppelgänger at around 960x720 so I counted up how many places he was moving each time I added to the X position on a calculator and came up with 10560 that put the doppelgänger in the same room as the player. Then measured the distance in blocks of 16x16 how much more I needed to add to position the doppelgänger in the right spot and got 10880.

    I'm afraid someone will have to explain how that works because it baffles the hell out of me, but at least it works!

    Check it out. This is awesome!
    Please login to see this link.

    Edited once, last by soopytwist (July 23, 2015 at 10:44 PM).

  • Hey, really glad to see you got it working!

    The reason why 10880 works is because it is double the X coordinate of where you want the mirror image to appear. So when your character is at 5440, the coordinate of the mirror, your doppelganger will be at 10880-5440, and so at X=5440 aswell!

    Loved the video, your game looks great! Do you have a development log where I can follow your progress, or twitter?

    SUPER MEGA BEST CAT ADVENTURES Please login to see this link. and Please login to see this link. live now!

  • Thanks PBarwick. No I don't have dev blog or anything, I'm just working on it in my spare time. I hope to be able to put my finished game on Kickstarter (I have an account there) for free. I sub Retro Gamer magazine and they always feature games like this and kickstarter seems to be the place to host them. Still got a lot of work to do though and that's before all the play-testing!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!