How do I let my platformer player move through solids?

0 favourites
  • 7 posts
From the Asset Store
Who wants to be a Millionaire Clone. An educational coding source
  • Hello everyone,

    I couldn't find an answer for my problem so I am creating a new topic.

    I am currently using Construct 2 and I try to create a little 2D platform game.

    The creation of some enemies walking from the left to the right and vice-versa has finally worked after a time. I set empty sprites called "Wall" (with the Solid behavior) onto the edges of the single platforms. When the enemies touch such a wall, they change their direction.

    This works fine so far. But the problem is now, that the player sprite itself also collides with those Wall sprites and thus is not able to move further (except they jump above the invisible block).

    My question is now: Is there any way to tell the player sprite to "ignore" collisions with specific sprites (in this case the "Wall" sprite?). The player is using the platform movement behavior.

    Thank you very much for your thoughts in advance.

    Best regards,

    teha

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Remove the solid behaviour from the invisible blocks and just make the enemies change direction on collision anyway. The invisible blocks should in this case just be used as triggers and not stop anything. You don't need a solid bahaviour to trigger a collision.

  • Oh, sure! It can be so easy!

    All a had to do (except making the Wall blocks unsolid) is that the enemies have to check for collision with offset, so that they never touch the walls (but change their direction in this case 20 pixels before).

    Thank you for your answer!

    Best regards,

    teha

  • No problem. You don't have to check for collision at offset in this case but it works as well. But enemy on collision with invisible wall --> change direction also works the same way.

    I guess you are using tiled background object for the wall so then you have to use the enemy object to detect the collision as tiled objects only can register overlaps. So on enemy collision with wall is how you should do it in similar cases.

  • No, I am using a normal sprite as the wall tile. I didn't use tiled backgrounds so far. Are there big differences in handling the wall collisions?

    I am currently checking if the enemy collides with a Wall object. If yes, change direction.

  • teha No, just that tiled objects don't have the on collision event. Tiled objects can only check for overlaps. But the way you do it is correct then.

  • Okay, thank you very much!

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