Behaviors and behavors

How can someone make behaviors that interact with each other like the platform and platformer object behaviors interact? Is it with JavaScript?

For example if I was to replicate the platformer behaviour (just an example not what I want to do) I would have to pass the platform object as a parameter of the platformer object and add an action declaring the identity of both objects on the scene for them to interact as scripted in the behavior. But those behaviors don’t work like that, all platformer objects interact as scripted with each type of platform object without any extra actions on the scene, just by having the behaviors attatched, and I want that, ¿how do I do that? ¿Is there a missing feature on the behavior editor that I should request or is it something that can be done with a js block ?

I hope someone helps you bc I’ve been curious for some time. I do believe it require Javascript. I know the basics of JS but using it with behaviors and things like containers still confuses me.

This link might help.
https://docs.gdevelop.io/GDJS%20Runtime%20Documentation/modules/gdjs.html

The platform and pathfinders both use a manager.

It says here that the behaviors have to declare themselves.

I’ve tried understanding it by looking at the user created nav mesh pathfinder but I couldn’t understand the process.

1 Like

Interesting how the platform has a manager while the platformer doesn’t. Thanks for that, something is alway better than nothing. Have you aked the engine Devs about this subject?

The characters need to check collision with platforms but platforms don’t need to check collision with characters.

If you want examples of extensions there are:

More about it here:
https://wiki.gdevelop.io/gdevelop5/events/js-code/javascript-in-extensions/#learn-by-reading-code-from-the-community

but using events, you can “bind” objects by calling a behavior action every frame instead of using the life-cycle function of the behavior.

This example uses several dedicated behaviors that work together to do complicated logic that would be very hard to follow if events were in the same list.

1 Like