Fall through Platforms/Crouch/Jump Sustain

For questions about using Classic.

Post » Sat Jan 17, 2009 4:56 pm

The Platform Behavior has an option called "allow down button" which makes your player fall through platforms when he hits the down control.

I want to allow my player to crouch while on platforms and fall through them if he jumps while holding down. I can uncheck "allow down button" and in the event sheet editor check for down AND jump and set the player to "fall through platforms", but the jump action happens before he starts falling and he winds up jumping.

If I disable the jump as a control and just check for when the shift (jump) button is pressed, I can make the character jump while standing and fall through platforms while ducking.

The problem with this is that when you make the player jump with event code, it ignores the "jump sustain" property.

Is there a better way to allow crouching on platforms, falling though platforms with down and jump, and jump sustain?

Thanks for any tips!



--Edit--
Wait a minute. What if I just set the player's jump strength to 0 while ducking? I think that just might work. I'll try it out.
B
4
G
3
Posts: 21
Reputation: 942

Post » Sat Jan 17, 2009 10:48 pm

[quote="qxface":239o6kfp]What if I just set the player's jump strength to 0 while ducking? I think that just might work. I'll try it out.[/quote:239o6kfp]

I'm not on my Construct computer right now, so I can't test it out, but if that doesn't work, you could try something like:

[code:239o6kfp]
(at the top of your control events)
+Always
->playerSprite[Platform]: Don't ignore input

+On control "Jump" pressed
+Control "Move down" is down
+playerSprite is overlapping Platform at offset (0,2)
->playerSprite[Platform]: Ignore input
->playerSprite[Platform]: Fall through platform
[/code:239o6kfp]

That way it will ignore the controls for a single tick so you won't jump, then reactivate the controls at the start of the next tick. I did something similar for the fall-through platforms in Little Hitler in Toyland, but I can't remember the exact method. I'll look it up as soon as I can get at Construct.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sun Jan 18, 2009 3:42 am

Thanks for the reply. i'm thinking now that I'll probably use some detectors to see if the player is on solid ground or a platform and adjust the code thusly (pretty much what you said)

So (hint hint) keep those platformer tutorials coming, please!
B
4
G
3
Posts: 21
Reputation: 942

Post » Sun Jan 18, 2009 4:05 am

[quote="deadeye":1genpifq]I'm not on my Construct computer right now ...[/quote:1genpifq]

So in other words that's just off the top of your head. Right. The only thing I can get off the top of my head is dandruff. *sigh*
B
3
S
2
G
4
Posts: 271
Reputation: 2,017

Post » Sun Jan 18, 2009 11:21 am

The method I posted before doesn't seem to work the way I thought it would.

This, on the other hand, works like a charm:



And it's the simplest method I could come up with. Setting it to fall when Jump is pressed won't mess things up when you're jumping without holding down because it processes the jump before the fall, it seems.

By the way, David... the Yes and No seem to be reversed in the "Fall through platforms" dropdown ;) (which means that in event 3 you're actually telling Construct to fall, and in event 2 you're telling it not to)
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sun Jan 18, 2009 4:21 pm

Thank you that works beautifully!
B
4
G
3
Posts: 21
Reputation: 942


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests