How do I make an object solid only in one direction

0 favourites
  • 10 posts
From the Asset Store
Character Sprite Pack: Walk 4 Directions made in illustrator
  • I am trying to create a game in which I need the sprites travelling in the direction of a ramp to move up the ramp but if the sprites is travelling in the opposite direction to the ramp they should just pass through the object as if it;s not their. I cant seem to find anyway around this obviously if the ramp is a solid the sprites that all have the platform behavior on them walk up the ramp as i would wish but when traveling from the opposite direction they are hitting the ramp solid instead of passing through as i would wish.

    I have a fudge to get around this where I leave a gap below the ramp big enough for the sprite to pass under and when travelling in the direction of the ramp the sprite jumps up on to it but I was hoping someone may have a better way to do this?

  • You could try something like this:

  • Rushty

    Well, I started to suggest a couple complicated ways to do it, and decided I better test it out first. I started a new platform template project, and very quickly discovered that the Jump-Thru behavior does exactly what you want (and that my suggestions were terrible).

  • Thanks for the replies but unfortunately neither of these will work. Phimaka's suggestion would work with a single sprite but as I have multiple sprites potentially moving in different directions at the same time disabling the solid could cause issues.

    Jumpthrough is not an option as that's doing exactly what is says allowing the sprite to jump through a platform which isn't what I am trying to achieve. I have put together a quick example in which you can see the sprites go up the ramp, fall down to the other site and then are stuck between the wall and the ramp but where I would like them to pass back through the ramp going back the other way hit the other wall then go back up the ramp and repeat.

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

  • Hi Rushty,

    I've tried something out. Don't know if it works for you:

    I used overlapping to check if the sprite collide with the ramp, then disabled Platform-Behavior, move the sprite every tick 5 pixel to the left , set direction to 0 so when the sprite leaves the ramp it has set the correct direction.

    After leaving the ramp I enable Platform-Behavior.

  • This might be usefull, allthough it might not be:

    One way wall - capx

    Using 8 direction behaviour the wall can be gone through from the left but not from the right..

  • Thanks for the suggestions, I think Asomedean's idea may work better than my current setup, it may cause a few other issues but this seems to be the best idea so far. Would be nice if their was a feature to allow you to specify the layer the platform behavior was interacting with so you could swap it around or have single sided collision polygon but will just have to work with what we have.

  • Rushty

    I looked at your example, added a jump-thru ramp and it does exactly what you want.

    The ramp shouldn't have the solid behavior and probably needs to be on an angle (possible reasons why it didn't initially work for you).

    http://www.rieperts.com/games/forum/jumpthru.capx

  • ta, that looks more like it. never thought of angling the sprite, doh!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This might be usefull, allthough it might not be:

    One way wall - capx

    Using 8 direction behaviour the wall can be gone through from the left but not from the right..

    LittleStain

    Could you put your demo up again? A one way platform is (a bird table for a bird to land on going downwards, but not get blocked going upwards) is exactly what I'm looking for.

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