How do I Solve this Issue With a Condition

Get help using Construct 2

Post » Sat Aug 15, 2015 2:01 pm

Hello there i'm working on a platformer with a Physics engine and i have recently implemented a custom "jump thru" function using these conditions in the image (1) , its works well aside from the fact that if the player docent press any other button and lands on a platform and trys to jump thru again it will not register , im assuming this is because of the on pressed condition only works once where as we need this to work multiple times , if any one can suggest a solution that would be great.

(1) http://i.imgur.com/1kdddEk.png

Thanks for your time ,Ryan.
B
6
S
1
Posts: 53
Reputation: 529

Post » Sat Aug 15, 2015 3:04 pm

Just a stupid question from my side. What's wrong about the built in Jump-Thru behavior? It works fine for me ;)

In your code example the Function will be called every time the Space key gets pressed. So this should be fine. I'm not quite sure about the 'wait' action in the function.
I have something in mind that wait actions in a function can cause issues. But I'm not sure about that.

I would recommend to use following code.

GlobalVariable: IsOnJumpThru (Or boolean for the player, is up to you)

//This is simular to your function.
On Function "JumpThru" (alternative: Player is on Jumping && Trigger Once While True
- Set IsOnJumpThru to 1
- Disable Physic Collisions for Player A
- Disable Physic Collisions for Player B

//Once the jump is over (when the player was landed on the platform)
If IsOnJumpThru = 1 && Player is ladding
- Set IsOnJumpThru to 0
- Enable Physic Collisions for Player A
- Enable Physic Collisions for Player B

Regards
Andreas
Image Image iTunes: Match3 | Google Play: Match3
B
107
S
39
G
31
Posts: 1,173
Reputation: 29,260

Post » Sat Aug 15, 2015 4:59 pm

Hey there thanks for your reply , To answer your question i am using physics rather than the platformer behavior with the players , the jump thru wont work with physics and needs to be done spereatly , i apologies for making that unclear.

Also i will give you suggestion a try alto its not any issue with function or wait as those things seem to be fine rather its not recognizing multiple inputs , again thanks will update after have tried this.

Thanks for your time ,Ryan .
B
6
S
1
Posts: 53
Reputation: 529

Post » Sat Aug 15, 2015 5:23 pm

The issue probably is the Wait, as there is no way to cancel a wait, so when you hit the key again, you set the disable but there is still that wait in the background, and it will kick in and cancel out your disable. Try using a timer, instead of wait. Then you can reset the timeout on the next key press if it comes in quickly, and you can push out the enable code.
ImageImageImage
B
71
S
22
G
258
Posts: 3,791
Reputation: 143,198

Post » Mon Jan 02, 2017 2:12 pm

Just came across this old topic because I'm facing the same issue now. Is there a specific reason why jump thru doesn't work with physics @ashley ?
I'm using the physic behavior for my player and the world. Some platforms have the jump thru and physic behavior, but then jump thru doesn't work like it should anymore.

Thank you!

Regards
Andy
Image Image iTunes: Match3 | Google Play: Match3
B
107
S
39
G
31
Posts: 1,173
Reputation: 29,260

Post » Mon Jan 02, 2017 2:24 pm

You can't mix most behviours with Physics. This has come up many times.
ImageImageImage
B
71
S
22
G
258
Posts: 3,791
Reputation: 143,198


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 6 guests