How do I get platform actor to adapt speed to a moving solid

Get help using Construct 2

Post » Tue Nov 01, 2016 8:33 pm

So if I use a solid tiled background with a sine moving it horizontally, my character lands on it and is "pinned" and moves with it. Half way through the cycle (while the platform has a decent amount of speed) I jump and the platform sprite just stays in place. I want it to retain its speed when leaving the moving platform. Like... you know... the laws of physics suggest should happen. ;)
B
13
S
4
Posts: 61
Reputation: 1,028

Post » Tue Nov 01, 2016 9:34 pm

You dont need the pin. When you make a new project, there is a template 'platformer'. It solves your problem.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue Nov 01, 2016 10:49 pm

It's not using the pin behavior. I was just describing what happens when you land on a moving solid block. I'm thinking I'm going to have to the moving block save its position, and compare it next tick to give a distance moved and have it apply that value to the player when it they jump off. I dont know. I'll figure something out.

edit: the template platformer has the same problem anyway. You jump when the block your on is moving and you just stay in the same place..
B
13
S
4
Posts: 61
Reputation: 1,028

Post » Tue Nov 01, 2016 11:45 pm

B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Nov 02, 2016 12:04 am

something like that. directly manipulating the x and y while using movement behavior can cause it to glitch out on collisions.
B
13
S
4
Posts: 61
Reputation: 1,028

Post » Wed Nov 02, 2016 12:38 pm

That is true, but since you choose for sine (wich pushes things to any and every solid), i did't think that would be a problem. Must manipulate vector X and vector Y. But that gonna be hell if you want it to land on an exact place on the sine.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Nov 02, 2016 8:23 pm

Not land on the same point. Just keeping the momentum gained from riding the platform. It shouldn't be too hard to get working. It would be nice if it was built in but yeah. Thank you for your response. I rarely get responses or help on these forums.
B
13
S
4
Posts: 61
Reputation: 1,028

Post » Wed Nov 02, 2016 11:34 pm

Got to add the vector of the platform to the vector of the player on jump.

https://www.dropbox.com/s/3jxpiwz7k2kyp ... .capx?dl=0

I used a platform to move the platform. I like that movement.
But. It has a bug when you jump from beneath against it. Suddenly a zero gravity gets non zero. Lower the upper platform to see it happen.
The reason why i tried platform to move it, is because you said something about collisions, and i need an already dt corrected vector. (sine is not)
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu Nov 03, 2016 3:41 am

I think we would be able to use the solid sine movement if we could use DT to "transpose" pixels moved per tick to pixels per second for the platform velocity to manipulate. I began using my own variables to run platform.velocity X/Y directly instead of using "default controls". So it's just going to take some flag switching and setting the platform velocity directly to general x/y velocity for the player to work under and an absolute x/y that gets set when leaving a platform or getting smacked by one or something. But since the platform velocity works in pixels per second... What do you think the math behind that would be?
B
13
S
4
Posts: 61
Reputation: 1,028

Post » Thu Nov 03, 2016 4:12 am

Im thinking pixels per frame to second would just be "self.X - self.prevX * fps", and pixels per second to frame would be self.Platform.VelocityX * dt.

edit: It seems I have found solace in this:
On Jump Overlapping TiledBG2
self.VelX = (self.VelX + (TiledBackground2.X - TiledBackground2.prevX) * fps)
B
13
S
4
Posts: 61
Reputation: 1,028

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 22 guests