Platform objects, collide only, solids same layer

0 favourites
From the Asset Store
The complete source file for my Youtube platformer game tutorial series.
  • 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 / ValkyrieGames

  • Selective solids collision is indeed a tricky thing! You will have to use clever events to enable/disable solids.

  • 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... ):

  • 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?

  • 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

  • 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

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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 :(

  • 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.

  • 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

  • I've tried to do the same - I would also really like an option in the properties to make the platform object only interact with objects on its layer.

    The only workarounds I've found or thought of are to either:

    1: use custom movement instead, requires a lot of events

    2: (haven't tried this, might not work) do something wacky using a combination of platform without solids and use custom movement for the collisions and events for the jumping (this will muck around with the 'is jumping' and such, though and probably is complex enough that you might as well use the custom movement entirely)

    3: actually have all the different layers displaced so none overlap, then have 'fakes' projected at the proper location.

    This is a feature I've wanted since the early days of CC. Ashley, any chance this could be put on that huge todo list of yours? ^^

  • oh you still want enemies on other layers to work. Then maybe stick with my other suggestion about the solids like I said. Then disable the controls on your enemies and just let em use a sine behavior or similar while theyre on different layers. That way they could still simply move back and forth or whatever regardless of actual solid collision

  • Arima Yes exactly, I think an option for objects to interact with only those objects in the same layer would simplify things greatly, and also allow us to make more interesting games with the physics. Implementing it shouldn't be too difficult from what I know. I hope Ashley will have time to add this in to his busy schedule :)

    Your suggestions 1 and 2 I have thought of, but it feels like too much trouble to go to when the physics engine is just there, and is almost everything you need - especially for making everything more realistic! Suggestion 3 is actually a great idea which I hadn't really thought of. It's a little extra trouble and not quite as neat as I would like it but it could work. The game I'm making is for the mobile though so I would like to not have to use so many extra resources. Let's see if Ashley can find some time to add in the functionality we require :)

    aridale Thanks for the suggestion but it'll require a bit too much custom movement than I would like - I also have the problem that the platforms are hills (so slightly rounded!)

  • I have the same problem, and now i see others have it i think i can give a shot to making a mod of the basic platform behaviour... shouldn't be that hard... right?

    Also... i have a doubt �the condition "[sprite]is overlapping" works when the object's collision is disabled?


    �Finally, here it is, but i don't know exactly how to post it on the plugin database if there's any?

    Long story short, its a mod over the standard Platform Behaviour with the ability to enable and disable wheter to ignore solids in other layers.


    I did two basic examples based on already existing examples, check this out please


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