I am trying to use the FireBullet behaviour using JavaScript in gdevelop5. I added the following code to implement that:
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 the following image:
The value of firebullet is found to be [object Object] in the debugger. I can't find a way to get the exact object, but it confirms that the behaviour is present.
Any help telling how to fire a bullet using the behaviour from js will be greatly appreciated. Thanks!