Create a behavior and reference a behavior properties

So getting to know the engine i ran in the problem where i have these dodge balls that a character in the game get hit by, some time when the ball bounce on top of the character head it’ll get stick there and as the character is actually moving the dodge ball stay still/move through the character, if another dodge pass near it or hit the stuck dodge ball it’ll become unstuck. I don’t know if it a limitation of the physic engine or something i’m doing wrong but anyway i though of one one to fix this problem is to use behavior since that is one of the very few things i haven’t played with in gdevelop.

So with a behavior I want to make it to where the ball disappear after a certain amount of time pass:
I created a behavior with property life_span type number
I created a timer in onCreated name life span
I create a condition in doStepPreEvents that check the timer against the value of the behavior property life_span and if it equal or greater delete object and timer.

The problem I am having is I don’t know how to reference the behavior’s properties in the behavior event sheet to compare the timer value against it. At first, i though the behavior add it’s properties on to the object, but it not working.

I research this and the only thing I can come across of informing information on the subject is here: Custom behaviors: create your own behaviors with events [GDevelop wiki] and a video but not exactly on how to reference it.

If your property is called life_span the expression should be Object.Behavior::Propertylife_span()

Properties can be inserted using the expression editor by finding the drop-down menu with your behavior and the property should be visible there.

1 Like

I see.

How about with the ball being stuck in place when it rest on their head and almost become static as the character pass through it.