How do I let my platformer player move through solids?

Get help using Construct 2

Post » Mon May 22, 2017 8:40 am

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
B
3
Posts: 4
Reputation: 198

Post » Mon May 22, 2017 9:02 am

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.
B
57
S
24
G
14
Posts: 772
Reputation: 13,135

Post » Mon May 22, 2017 11:02 am

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
B
3
Posts: 4
Reputation: 198

Post » Mon May 22, 2017 11:40 am

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.
B
57
S
24
G
14
Posts: 772
Reputation: 13,135

Post » Mon May 29, 2017 1:26 pm

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.
B
3
Posts: 4
Reputation: 198

Post » Mon May 29, 2017 1:28 pm

@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.
B
57
S
24
G
14
Posts: 772
Reputation: 13,135

Post » Tue May 30, 2017 11:23 am

Okay, thank you very much!
B
3
Posts: 4
Reputation: 198


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 15 guests