Custom flying platforms

Help!!

I am trying to create a flying platform with wings - picture attached. The platform will fly up and down within a limited space, and there will be many of these. Needless to say I don’t want to make the wings behave like the platform. I only want player to be able to land on the flat part of the platform.

My solution: I created a hitbox the same width of the flat section (and low height) and hid it for each instance of the platform (Oh - the platforms are randomly and procedurally generated). I am then moving the platform sprite up and down based on a random speed so that each platform moves up and down slightly differently.

My Problem: How do I make the hitbox move in sync with the platform? Is there any way to associate a hitbox instance with a specific platform instance and let it “inherit” the same movement? The only other option I can think of is to repeat the entire logic for the platform sprite for the platform hitboxes as well, but that seems extremely inefficient, and adds other complexities (how does the platform sprite and associated hitbox have the same random speed and direction values?).

Any ideas of how I can make this better?

Looking forward to your feedback.

Thanks!
Sam.

Hi, you probably need to link the platform with the hitbox (Link two objects). For moving both together you put in the condition: > Take into account linked objects - and as action > Put the object around another . You can find an example for something similar here:

1 Like

You can go the linking route if you want that would work but if it were me I would just change the collision mask on the sprite then you don’t have to add any additional logic.

3 Likes

Thanks krunkster - I had never used the Linked Object route. This worked!

Hi Drona,

Thanks for the idea! I tried it (applying a custom hitbox to the sprite) but now when I turn on the Platform Behavior to the platform, my player simply falls through. I am attaching screenshots of the platform and custom collision box that I drew. If my player is a PlatformerObject and the sprite is a Platform with the custom hitbox, then it should work right?

Oh…and I didn’t share same collision masks for each animation because the sprite moves around in the animation, so I drew the mask in each animation frame to ensure that it is placed at the right spot.

Yes, actually that should work.

It’s weird…my player is falling right through the platform…it’s not working. Can you think of anything that may be causing this? This shouldn’t have anything to do with code because it should be based on native GDEVELOP functionality as far as I understand it

Did you read this Help: player keeps falling through platform ?

Thanks for the collision mask idea…I replied to Drona’s post as well…you can see the screenshots there. It’s not working…any idea why?

Thanks!!