Mirroring a moving object's position

0 favourites
  • 9 posts
From the Asset Store
This is a code so you can see the same skin on all screens (peers). Each peer gets a skin, in addition to 4 directions t
  • Hey there, good people!

    I've been testing and playing around with platforming behavior and a grabbing mechanic that some of you helped me with a while ago and I've run into another little problem I can't figure out how to get past.

    I've made it so my player object can stand on and jump from a moving platform. I've however run into some problems getting the player to follow along a horizontally moving platform when hanging underneath it. I've tried with pinning the player underneath it when grabbing on, but it doesn't allow the player to move from side to side while hanging.

    Is it possible to access the left/right movement that follows the platformer-behavior and make them relative to the movement of the platform somehow? This would also make it possible to get the right behavior while hanging on the sides of a horizontally moving platform.

    It's kind of a tricky thing, and I wouldn't ask for help unless I could figure out how to solve it. I dunno if I've just missed something really simple or if I'm just looking in the wrong places.

    What do you think? Any ideas? <img src="smileys/smiley1.gif" border="0" align="middle" />

    Arrows to run, space to jump and shift to grab onto something. (it's just a testing environment so don't expect much for level design <img src="smileys/smiley2.gif" border="0" align="middle" />)

    dl.dropbox.com/u/12077257/Tester.capx

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Have you thought about an invisible "helper plattform" underneath the "grabbed" plattform?

  • You mean so that the player could actually be standing on that one while looking like he's holding on to the platform ontop? That could be a fix for it, but would require a lot of extra work on the level design. I'm trying to find something that would fix the problem rather than the symptom, but if I can't find anything else I'll probably just go for that.

    Thanks for the suggestion! <img src="smileys/smiley12.gif" border="0" align="middle" />

  • Maybe you could create the invisible helper "on the fly"?!

    I just took a look at your code. I think one option would be, to make the horizontaly moving platforms "unique", ie. the code should be able to tell, that the grabbed on plattform is moving. Then you could use the changing X value of the plattform to be added to the players X as long as the player is holding on to the plattform.

  • Yes, I thoguht of that too, but I couldn't figure out how to get a hold of the changing x value of the platform. Since what I want to add to the player's x-position isn't the platform's x-position but rather the change in it from the last tick.

    Player.x = player.X + Moving Platform's latest change in x-position.

    I've no idea how to grab that change in value. <img src="smileys/smiley19.gif" border="0" align="middle" />

  • Do you really need the delta? I would think, that the players X is the plattform X plus some sort of offset. And the offset is determined by the position the player grabs a hold on and his on movement on the x axis...

  • Yes! That cleared it up for me! Thanks, Weishaupt! Thanks a lot! I got it working for hanging under horizontally moving platforms and will use the same technique for hanging on the sides of vertically moving platforms.

    Thanks again, dude! <img src="smileys/smiley31.gif" border="0" align="middle" />

  • Glad that our little "chat" could clear things up!

    Let me know if I could be of any assistence in the future!

  • Will do! <img src="smileys/smiley1.gif" border="0" align="middle" />

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)