How do I make an object solid only in one direction

Get help using Construct 2

Post » Sun Aug 16, 2015 2:58 pm

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?
B
10
S
2
Posts: 12
Reputation: 632

Post » Sun Aug 16, 2015 3:38 pm

You could try something like this:
Image
B
15
S
6
Posts: 105
Reputation: 1,356

Post » Sun Aug 16, 2015 7:32 pm

@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).
B
97
S
34
G
20
Posts: 438
Reputation: 17,790

Post » Mon Aug 17, 2015 7:37 am

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
B
10
S
2
Posts: 12
Reputation: 632

Post » Mon Aug 17, 2015 9:53 am

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.

Image
B
24
S
3
G
1
Posts: 451
Reputation: 2,165

Post » Mon Aug 17, 2015 10:15 am

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..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Aug 17, 2015 3:49 pm

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.
B
10
S
2
Posts: 12
Reputation: 632

Post » Mon Aug 17, 2015 4:45 pm

@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
B
97
S
34
G
20
Posts: 438
Reputation: 17,790

Post » Mon Aug 17, 2015 5:16 pm

ta, that looks more like it. never thought of angling the sprite, doh!
B
10
S
2
Posts: 12
Reputation: 632


Return to How do I....?

Who is online

Users browsing this forum: Kin, mickclarke, tinhofiel, TRMG and 55 guests