Moving platform problem

0 favourites
  • 7 posts
From the Asset Store
Wanting to do a Shot n Run game easily? Here is your chance!
  • 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?.

  • How about a work around then <img src="smileys/smiley24.gif" border="0" align="middle" /> Anyone?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

  • 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

    <img src="smileys/smiley4.gif" border="0" align="middle" />

    Thanks so much !

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

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

    <img src="smileys/smiley4.gif" border="0" align="middle" />

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

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