4ian / GDevelop

🎮 Open-source, cross-platform 2D/3D/multiplayer game engine designed for everyone.
https://gdevelop.io
Other
11.33k stars 871 forks source link

Jump down through platform in "PlatformerObject" #1339

Closed CustomLenny closed 3 years ago

CustomLenny commented 4 years ago

Description

There is no way to trigger (even through javascript as far as I could tell) the platformer characters to be in a force falling state. I couldn't find any way to shift a character below the platform and have him fall. The down arrow when set to sidescrolling is not used for anything besides going down a ladder. When on a "jumpthrough" platform the down arrow should be able to let the character drop through the platform. Jump down is sometimes done by holding the down and then pressing the jump, but it doesn't need to be that way as anybody who would like it that way can easily do that through the editor, in addition to that that would be a bad way for mobile devices.

Solution suggested

Down arrow on a platformerobject set to sidescroller lets player fall through the jumpthrough platform.

Alternatives considered

Javascript ways to set the isfalling and isjumping and any other flags by force.

4ian commented 4 years ago

I've added a card for this on the roadmap: https://trello.com/c/jFSuWrm6/391-allow-platformer-objects-to-fall-from-a-jumpthru-platform-when-a-specific-key-is-pressed I'll close the issue as it's a feature request but discussion can continue here.

Have you tried to change the Y position of the object to add 1 pixel? In theory that should put the object below the jumpthru and have it fall.

CustomLenny commented 4 years ago

Have you tried to change the Y position of the object to add 1 pixel? In theory that should put the object below the jumpthru and have it fall.

Yes I have (and more than 1 as well), the flag for is on ground or is falling does not flip though so when moved down it still thinks it hasn't left the ground.

4ian commented 4 years ago

An alternative could be to temporarily disable the jumpthru "platform" behavior for a few frames, letting the time for the platformer object to fall (one frame in theory should be enough) - but with the downside that other platformer objects on the platform will fall too.

I've checked the code and yeah seems that if I don't add something to force the "on floor" flag to be false, the object will try to stick to the floor as long as it's nearby.

CustomLenny commented 4 years ago

An alternative could be to temporarily disable the jumpthru "platform" behavior for a few frames, letting the time for the platformer object to fall (one frame in theory should be enough) - but with the downside that other platformer objects on the platform will fall too.

Yeah I have more than 1 platformer character. Which the idea of adding a fall through will surely be of use to any items that are using platform character as well.

I've checked the code and yeah seems that if I don't add something to force the "on floor" flag to be false, the object will try to stick to the floor as long as it's nearby.

I read through the code a bit and was trying to change the flags with javascript in gdevelop, this is despite the fact that I also saw that the bindings didn't exist to those functions anyway :P

4ian commented 4 years ago

I think the solution lies in adding a function that would set _isOnFloor to false (I've not verified that it's enough, potentially other flags too).

I'll see if I can find time for this

On Sat, 28 Dec 2019, 11:39 Custom, notifications@github.com wrote:

An alternative could be to temporarily disable the jumpthru "platform" behavior for a few frames, letting the time for the platformer object to fall (one frame in theory should be enough) - but with the downside that other platformer objects on the platform will fall too.

Yeah I have more than 1 platformer character. Which the idea of adding a fall through will surely be of use to any items that are using platform character as well.

I've checked the code and yeah seems that if I don't add something to force the "on floor" flag to be false, the object will try to stick to the floor as long as it's nearby.

I read through the code a bit and was trying to change the flags with javascript in gdevelop, this is despite the fact that I also saw that the bindings didn't exist to those functions anyway :P

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/4ian/GDevelop/issues/1339?email_source=notifications&email_token=AAJYRAVMPJ6DHDO6B4HAROTQ24UGPA5CNFSM4KAJLWQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHYHA7Q#issuecomment-569405566, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJYRAQQFTTSOXJ2EQ3CSQLQ24UGPANCNFSM4KAJLWQA .

CustomLenny commented 4 years ago

Thinking more on this. Maybe there should be an option to pass through solid platforms as well. If one wants to make the death a commander keen/monster bash/mario effect (the character gets thrown in the air and then passes through the bottom floor to disappear off screen, there's not really any way to do that either.

4ian commented 4 years ago

For this case I would recommend to deactivate the platformer behavior and manually animate the object with forces. It's something that "break the physics" of the platformer engine (an object going through something that is supposed to be solid), so better completely disable it for your object at this moment :)