Platform objects, collide only, solids same layer

Get help using Construct 2

Post » Thu May 10, 2012 3:44 pm

Hi there,

I was wondering how I could make platform objects only collide with solids on the same layer. (Note: I might have more than one platform object on the different layers, so simply disabling solids on another layer will not work - the other platform objects will end up falling through). This is because I have a simple platformer game that requires multiple platforms to walk on, one in front of the other in the z direction (simulated by making closer platforms lower (ie with a greater y value). I placed each platform on a separate layer, each as a solid object. Now I tried to create a platform object on the layer closest to the player (ie with the higher y value) but this does not work, because Construct thinks that the player is colliding with the far away platform (lower value of y) because according to y values, the platform object collides with that platform first.

Is there any way I can make the platform object collide only with solids on the same layer? Or if not, is there any other way I could get this to work? The platforms are actually "rounded" so simply making the platform object change its x or y value will not work.

Thanks for your help in advance!
Dengke Sha / ValkyrieGamesvalkyriegames2012-05-13 14:33:53
B
19
S
5
G
4
Posts: 85
Reputation: 4,925

Post » Thu May 10, 2012 6:04 pm

Selective solids collision is indeed a tricky thing! You will have to use clever events to enable/disable solids.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Thu May 10, 2012 6:07 pm

Lol only problem with that solution is that I have more than one platform object moving around at a time. So I can't simply enable and disable platforms... ):
B
19
S
5
G
4
Posts: 85
Reputation: 4,925

Post » Thu May 10, 2012 6:24 pm

Hmm... The only way I can see to do this then, is make your own movement or something... @Ashley is there any solution for this at all?
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Fri May 11, 2012 6:29 pm

maybe on a layer change loop thru all the solids and disable solid on all of em not on the same layer? That should work and not cause too much overhead cause its only done once you change layers
B
13
S
5
G
2
Posts: 306
Reputation: 3,262

Post » Sat May 12, 2012 3:06 am

Thanks for the suggestion @aridale, but how do you mean? There might be more than one platform object (which could be on a different solid on a different layer to the player) so enabling and disabling them wouldn't work. Unless I've interpreted this wrong!

@Ashley No chance there's a simple option in Construct 2 that'll fix this? Like a "collide only with objects on same layer" event/instance variable? xD
B
19
S
5
G
4
Posts: 85
Reputation: 4,925

Post » Sun May 13, 2012 9:00 am

use a family for all the objects that have the solid attribute and then loop thru the family and disable solid on all of em not on the same layer as the player
B
13
S
5
G
2
Posts: 306
Reputation: 3,262

Post » Sun May 13, 2012 9:48 am

@aridale Sure but there are enemies that are also Platform objects like the player. If they stand on a different layer, if the solids get disabled, they will fall off... so it won't work :(
B
19
S
5
G
4
Posts: 85
Reputation: 4,925

Post » Sun May 13, 2012 11:40 am

Kinda what sqiddster said, make custom movement for the enemies. Like make them move along a set path or something and have the platform behavior turned off. But I see how this would not work if you wanted smarter ai, that would try to run towards the player. But maybe switch in between the two movements for what layer the player is on, but i'm not sure how that'll work.
B
16
S
4
G
1
Posts: 47
Reputation: 2,542

Post » Sun May 13, 2012 11:59 am

should the event "is on layer" not work?,

for each objects is on layer "solid" set solid enabled

is not on layer "solid" set disabled

+ then you can move objects from and to this layer if needed

ImageImage
B
61
S
19
G
6
Posts: 809
Reputation: 9,028

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 21 guests