Platform Collision Check w/out Using Solid Behavior

Get help using Construct 2

Post » Wed May 03, 2017 2:24 am

I'm working on a game where you can switch between the foreground and background to avoid detection by guards. Doing this also allows the player to go behind or in front of solid objects (ie: a stack of boxes in the background can be passed in the front).

Regarding just the player, this is not an issue.
In order to avoid stopping the player from walking passed the boxes (or other objects that would normally have the Solid behavior), I can simply test if the player is on the same layer as the boxes. If not, I turn off the Solid behavior and the boxes are nothing more than sprites.

The problem is when I include the enemies who also will use the Platform behavior and will need to be able to interact with objects that are supposed to be solid (regardless of the layer the player is on). Because if the payer is on a different layer than the solid object, then I'd have to turn off the Solid behavior. But if an enemy is on top of those solid objects, they'll fall through the sprites due to their Platform behavior...no Solid to hold them up.

So I need to work out a different system of collision detection AND, more importantly, how to make "solid" objects act like solid objects without the solid behavior.

So far, I have figured out, for example, how to use Overlap or Overlap At Offset to place the player on top of the boxes when he jumps up and falls to land on top of them. Problem is, if I walk up to the boxes from the side, the conditions still puts the player on top of the box. Part of that, I'm sure, just requires a couple extra conditions to test for the X position as well as the Y position of the player.

Still, even with that understanding, I'm struggling to find the best way to test for these conditions in the same vein that the Solid + Platform behaviors do. May I get some input on this, please?
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
141
S
23
G
8
Posts: 790
Reputation: 15,017

Post » Wed May 03, 2017 4:36 am

You're entering the 3rd dimension *creepy sound*

That is a bunch of work with Construct 2(D).
You should change to a 3D engine. Thet will do this work for you.

http://www.gamestudio.de/ is an easy to learn 3D studio and it's able to do 2D projections.
Image Image Image
B
43
S
22
G
15
Posts: 378
Reputation: 12,252

Post » Wed May 03, 2017 12:20 pm

Not really the answer I'm looking for.
I don't have time to learn a new game editor...
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
141
S
23
G
8
Posts: 790
Reputation: 15,017

Post » Wed May 03, 2017 2:29 pm

Read between the lines.
There is no 'easy' solution for this.
C2 only has solid behavior (for all platform objects).

You want to have a layered platform behavior but also with joined layers at some circumstances.
This is not possible with C2, except rewriting the C2 platform behavior for your needs.
My advice: leave it or change to an engine build for.
Image Image Image
B
43
S
22
G
15
Posts: 378
Reputation: 12,252

Post » Wed May 03, 2017 4:58 pm

I realize it's not easy. :) That's why I'm asking for help.
I know there is a solution - I can almost see it in my head. I just need help sorting out the details.
I already figured out part of it but I can see there's still more to account for. It can be done.
Already someone on one of the FB C2 groups suggested a workaround that doesn't involve using the Platform behavior for the enemies. So while more work, it potentially can solve my problem.

So, while I appreciate your advice, as I said, it's not the answer I'm looking for.
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
141
S
23
G
8
Posts: 790
Reputation: 15,017

Post » Wed May 03, 2017 9:33 pm

Sounds like you just want to deal with calculating collisions yourself. If that's the case, you could probably just search online for general info on how to do this since a lot of developers handle it themselves in other engines, programming languages, etc.

I haven't done this sort of thing in a long while so I've forgotten a lot. I think you just need to start anywhere and keep digging into it since there is a lot of material online..
here's what a quick search found me: http://noonat.github.io/intersect/

If you do figure out how to do it, I'd be interested too.
B
45
S
21
G
65
Posts: 1,115
Reputation: 38,221

Post » Wed May 03, 2017 9:35 pm

..there's also this page that I have bookmarked, which has a lot of useful information:
http://www.metanetsoftware.com/technique/tutorialA.html
B
45
S
21
G
65
Posts: 1,115
Reputation: 38,221

Post » Wed May 03, 2017 9:45 pm

(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
Last edited by SamRock on Wed May 03, 2017 10:35 pm, edited 2 times in total.
Create your own Isometric Runner Game using C2:

Image

Check out my game "Last of the Survivors":
Play Store
App Store
B
58
S
13
G
2
Posts: 421
Reputation: 5,397

Post » Wed May 03, 2017 10:21 pm

Thank you, both. I'll look up those links.

The main issue with disabling collisions is that I still need a collision detection of sorts, regardless of which layer the player is on.
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
141
S
23
G
8
Posts: 790
Reputation: 15,017

Post » Wed May 03, 2017 10:51 pm

another option might be to copy the solid behavior files into a new behavior and modify them so that it works in the way you need it to- assuming it can be modified to work the way you need it to :P
B
45
S
21
G
65
Posts: 1,115
Reputation: 38,221

Next

Return to How do I....?

Who is online

Users browsing this forum: Artcadev, ignaciosimo and 34 guests