Platform Collision Check w/out Using Solid Behavior

Get help using Construct 2

Post » Wed May 03, 2017 11:02 pm

SamRock wrote:(Disclaimer: Havent tried this myself)

When you move to other layer, try setting the Player's Collision property to false. If Solid Object.Layer = Player.Layer then set the collision back to true.

Not sure if it will help you, but its worth a try. Note that Player will not collide with any object when Collision is off.



Edit: Have a transparent sprite pinned around the player, whose collision is always ON, but its not solid. When it collides with a Solid Obstacle and Solid Object.Layer != Player.Layer , then set collision to OFF/False
Create your own Isometric Runner Game using C2:

Image

Check out my game "Last of the Survivors":
Play Store
App Store
B
57
S
11
G
2
Posts: 412
Reputation: 5,189

Post » Wed May 03, 2017 11:43 pm

BTW, could you paste a screenshot of your game? I am suspecting you are developing a isometric kind of game and need player to be able to walk infront of an object.

If so, dont mark the entire Sprite with Collision polygon, just make the base of the sprite solid.
See the trees on this screenshot. Instead of marking the entire tree as Solid, only the base of the tree is marked as Solid. In C2, you use the Collision polygon to mark its solid area.
Image

Once you have done this, you dont need different layers anymore (of course floor will still be a different layer),
Just check the Y position of the each colliding objects, which ever has a greater Y value comes to Top of layer ("Move to Top of Layer" action)
Create your own Isometric Runner Game using C2:

Image

Check out my game "Last of the Survivors":
Play Store
App Store
B
57
S
11
G
2
Posts: 412
Reputation: 5,189

Post » Thu May 04, 2017 4:45 am

That's basically just manually doing the platform behavior, since it's the platform behavior that makes the objects act solid.
Basically once the object overlaps a wall, you'd move it out in some direction till it's not overlapping. If the object isn't overlapping at its old position then move toward there. The other case is if you just place the Sprite in the wall, and it should just be moved to the closest open space.

That's only the first part. After that try moving horizontally then vertically to get to the place it was overlapping. Of course just stopping short. When moving horizontally and it hits a solid then set the horizontal speed to zero. The same for vertical. Without this part the object would just stick to walls. When moving vertically you can find when the Sprite is on the ground, and there is where you'd simulate a jump if the jump key is pressed.

Slopes would need some extra logic when moving horizontally, and moving platforms would need some logic too. It just depends what you need.

Also here's an entirely different idea I posted elsewhere before. It still uses solid but makes a duplicate of the layout in a different location.

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

Here's the topic it's from. Maybe one of those solutions will help.
ignore-selected-solids-workaround-list_t167029?&hilit=Disable+collision
B
91
S
31
G
102
Posts: 5,234
Reputation: 67,254

Previous

Return to How do I....?

Who is online

Users browsing this forum: Rudi55 and 6 guests