Bug with js in gdevelop

I am trying to use the FireBullet behavior in js. So I added a js codeblock with the following:

var player = runtimeScene.getObjects("Player")
let fireBullet = player[0].getBehavior('FireBullet')
fireBullet.FireBullet()

the FireBullet function does not work on the behaviour. On debugging I found that the variable fireBullet is not undefined, and contains the behaviour as it’s value, but I don’t know which function to use to get the same result as this:

Any help telling how to fire a bullet using the behaviour from js will be greatly appreciated. Thanks!

You can look at the code generated by GDevelop to understand how to do something similar.

1 Like