Mirroring a moving object's position

Discussion and feedback on Construct 2

Post » Tue Mar 13, 2012 3:49 pm

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?

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 )
http://dl.dropbox.com/u/12077257/Tester.capx
B
6
S
1
G
1
Posts: 15
Reputation: 1,014

Post » Tue Mar 13, 2012 3:52 pm

Have you thought about an invisible "helper plattform" underneath the "grabbed" plattform?
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Tue Mar 13, 2012 4:03 pm

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!
B
6
S
1
G
1
Posts: 15
Reputation: 1,014

Post » Tue Mar 13, 2012 6:53 pm

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.Weishaupt2012-03-13 19:05:11
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Tue Mar 13, 2012 8:10 pm

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.
B
6
S
1
G
1
Posts: 15
Reputation: 1,014

Post » Wed Mar 14, 2012 9:17 am

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...
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Wed Mar 14, 2012 10:48 am

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!
B
6
S
1
G
1
Posts: 15
Reputation: 1,014

Post » Wed Mar 14, 2012 1:18 pm

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

Let me know if I could be of any assistence in the future!
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Wed Mar 14, 2012 2:09 pm

Will do!
B
6
S
1
G
1
Posts: 15
Reputation: 1,014


Return to Construct 2 General

Who is online

Users browsing this forum: Televangelist and 11 guests