Moving platform problem

Get help using Construct 2

Post » Sat Feb 09, 2013 4:39 pm

Hi,

I have created 3 objects:
1 player with physics behavior, one horizontal sprite with physics and one sprite as a switch.
I want to move my player onto the platform and operate the switch to raise it.

This all works fine except when the platform moves up my player just falls through. I have tried adding solid to the player and platform but no difference. I have also tried changing the relative densities to no avail.

I assumed the physics behavior would just handle the collisions automatically.

Any ideas please?.spongehammer2013-02-09 16:39:39
B
44
S
15
G
9
Posts: 1,096
Reputation: 11,013

Post » Sun Feb 10, 2013 9:29 am

How about a work around then Anyone?
B
44
S
15
G
9
Posts: 1,096
Reputation: 11,013

Post » Sun Feb 10, 2013 10:07 am

The solid behaviour has no bearing on physics objects. These objects are considered to be solid regardless, unless collisions are individually disabled.

So, you've got an issue here, because you're using physics for your platformer, manually moving those platforms ("outside" of the physics-based actions) will cause some issues because you're saying "these objects are controlled by the laws of physics".

You're going to have to work within the physics actions to get your desired effect. In the case of moving platforms, that means shifting between the states of immovable and movable as necessary, and applying an upward force of varying amounts depending on whether you want your platform to move up or down. Down, in this case, is really just a controlled fall since you have gravity to contend with. Up would push against the gravity and would thus have to be quite strong.

A small example I put together. It doesn't use your switch but it should get the point across. The bounce is a little weird but I'm sure you could address that with some tweaking of the player's properties. Or leave it in there if it suits your game :P
B
56
S
15
G
10
Posts: 910
Reputation: 11,942

Post » Sun Feb 10, 2013 10:27 am

Ha ! Excellent thanks. I had been changing the y value by moving the platform rather than applying a force to it which makes perfect sense now you have pointed it out



Thanks so much !
B
44
S
15
G
9
Posts: 1,096
Reputation: 11,013

Post » Sun Feb 10, 2013 11:55 am

Something i still dont understand here. With your example if i replace the press up arrow with Every tick nothing happens. I also tried changing the Apply force at an angle to Apply Impulse at an angle, still nothing.

I have also tried

Every Tick
Set movable
Apply force
Set immovable

Doesnt work either. I am not sure if its something to do with the acceleration of the object being reset every tick?

Very strange to me.

B
44
S
15
G
9
Posts: 1,096
Reputation: 11,013

Post » Sun Feb 10, 2013 12:06 pm

Well the above statement is all still valid in as much as i dont understand why it doesnt work, however i have solved it by adding the bullet behaviour to the platform.

B
44
S
15
G
9
Posts: 1,096
Reputation: 11,013

Post » Sun Feb 10, 2013 12:10 pm

Every tick wouldn't work because the platform is set to immovable by default, it only changes to movable when any key is pressed. I can only assume the same is true of the impulse thing.

Interesting to know that bullet behaviour works, though. Glad you've found a solution.
B
56
S
15
G
10
Posts: 910
Reputation: 11,942


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 26 guests