Use object variable to create an object

I cannot use an object variable as an x position to create that object. I think it because Gdevelop take information from that object which haven’t been created yet.

imagine you have boss which you spawn when player reaches its room
IF you have boss hp stored in boss variable HP
And you care to display this value
Then it will show 0 unless you spawn that boss object

So it is not a bug but works as intended
Since to take value of variable of something
That something needs to exist 1st

Thats exactly why :slight_smile:

You cant use something that dosent exist… fairly certain thats intended and not a bug.

If you want help doing something in GDevelop you can always use the “How do i…?” section! Im sure someone will help you out :smiley:

Yeah that’s true but when i test it even if there is a already a existed boss, using “Create object” action with that object parameter still return 0, I think gdevelop using variable of the uncreated one. I mean this is gdevelop’s design choice.

As you see on top i change text to boomerang variable Angle

I run the game and that text is = to 0 cause NO boomerang is existing

And so as i throw at least 1 boomerang

So is it gdevelop design choice or you did something wrong?

Yeah I change the pos directly in the “create object” action and didn’t think about do it after like you did.

1 Like