Is there a way to write the code of each sprite inside itself?

Hello,

Is there a way to write the code of each sprite inside itself?
And not just in one place, like Unity and many other engines?

thanks

Hello SaeedP,

I think you can use the external events for that:

https://wiki.gdevelop.io/gdevelop5/interface/events-editor/external-events/

https://wiki.gdevelop.io/gdevelop5/events/link/

No, I think is not possible.

Do yoh mean like instead of doing code for each sprite do 1 line of code for all sprites

No, I mean write the codes of each object inside itself.
If you have experience with other engines you will understand what I am saying.
Imagine each object has its own class.

Oh. I think you can do that with javascript I am no good at Javascript but with gdevelop you pick an object and you write the code for it I am not sure how much experience you have with javascript

Before going down this path:

GDevelop is not Unity, and unity is not gdevelop. You shouldn’t be looking at how to replicate design practices between them as it will never be 1:1.

All of that said: The closest thing to object classes will be behaviors, and you can make your own behavior in an extension.

Keep in mind behaviors have slightly different development flows that the normal event sheet (you are calling a generic object type rather than a specific object name.).

1 Like