User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11

Thread: Creating a mirror image of the player

  1. #1
    Clicker Multimedia Fusion 2

    Join Date
    Feb 2007
    Location
    UK
    Posts
    243
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Creating a mirror image of the player

    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.


  2. #2
    Clicker Multimedia Fusion 2

    Join Date
    Feb 2007
    Location
    UK
    Posts
    243
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This might make things clearer. I stitched it together quickly so it's a bit rough.



    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.

  3. #3
    Clicker Multimedia Fusion 2

    Join Date
    Feb 2007
    Location
    UK
    Posts
    243
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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?

  4. #4
    Clicker Multimedia Fusion 2

    Join Date
    Feb 2007
    Location
    UK
    Posts
    243
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Mirror TESTS.mfa 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.

  5. #5
    Clicker Multimedia Fusion 2

    Join Date
    Feb 2007
    Location
    UK
    Posts
    243
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well I seem to have everything else figured out for my project except for this.

    Does anyone have any ideas about how to make that above Mirror TESTS.mfa work?

  6. #6
    Clicker Fusion 2.5 Developer
    PBarwick's Avatar
    Join Date
    Jul 2014
    Posts
    390
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    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!

  7. #7
    No Products Registered

    Join Date
    Aug 2014
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  8. #8
    Clicker Multimedia Fusion 2

    Join Date
    Feb 2007
    Location
    UK
    Posts
    243
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by PBarwick View Post
    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!
    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:


    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:


    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).

  9. #9
    Clicker Multimedia Fusion 2

    Join Date
    Feb 2007
    Location
    UK
    Posts
    243
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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!
    https://youtu.be/3QyM7toAoXw

  10. #10
    Clicker Fusion 2.5 Developer
    PBarwick's Avatar
    Join Date
    Jul 2014
    Posts
    390
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    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?

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Creating a Music Player?
    By sheppard1 in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 1st June 2020, 02:19 AM
  2. Replies: 1
    Last Post: 30th August 2014, 10:26 PM
  3. Creating a searchable image database(speed issues?)
    By Yima in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 21st March 2012, 11:38 AM
  4. Mirror a value within a range
    By Nifflas in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 21st November 2010, 01:28 PM
  5. creating a temporary dash for the player character
    By dfyb in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 6th May 2008, 06:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •