Classes that are not behaviors

GDevelop has a behavior creation feature. Unfortunately this feature does not allow any other objects in any events in the behavior, etc i cannot pass a floor object into my behavior which is understandable because of issues with using the behavior in other projects. My issue is i have a game with two cars which are seperate objects. I have a massive chunk of code for each car which controls movement, mechanics and collisions. I recently just made a massive change to this chunk of code for the first car, but now the issue is i have to change this for the second car as well, costing me another half hour or so of development time. What i need to know is how to create something like a class, which would be a project specific behavior that i could attach to multiple objects and pass different parameters to each, like keyboard and console controls (my game is local 2 player). While still allowing objects as parameters. In javascript this would be as simple as creating an object constructor and attaching all code to that, because in javascript you can put anything as a parameter. Please help me with this, the code will quickly become unmanageable without this.

well i am on the wrong profile. doesnt matter. please help!

ello there,
You may be looking for Object Groups, which allow you to make events for a type of object and use it across many similiar objects (two cars in your case).

I’m not sure I understand but I’ll talk in general terms.

Behaviors can be assigned to multiple objects. While you can’t change the individual instance setting in the behavior tab, you can change the properties with an action while the individual instances are picked like when they’re just added or if you pick them with a condition. Example, you can give each one an ID variable and pick the object with that ID.

If you’re setting something like keyboard shortcuts for the objects, you can either set the keys separately or create an action with a parameter for each key and set them all at once. You could also have default profiles in the behavior that could set the keys using a simple profile property. Changing the behavior’s profile property could change the properties of the defined keys.

I get frustrated that you can’t access other objects from a behavior like the builtin physics or platform behaviors. Some behaviors use managers which I don’t understand.

You can access other objects with JavaScript or by using a behavior function parameters set from a scene event like they do in the spawn behavior.

If that’s not what you mean, let me know.

This is my problem, i need the behavior to be able to access these things so that it will work with the physics in the first place and collision test for driving around.

I know about these but havent tried them, the issue here is that the cars have different controls and different movements so i cant make general code for each, i need a chunk of code with parameters i can customize, like in a behavior.

IDK if this is what you mean but you can use other behaviors within custom behaviors like the physics behavior.

You can mix things any various ways. You can use behaviors inside behaviors or multiple separate behaviors, you can use functions that are inside a behavior or functions from other extensions.

If you only have a few cars then you can use different objects not just instances.Then you could use the behavior’s setup screen to set the behaviors properties.