![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | !butterfry |
The following line of code got me the error mentioned above:
bullet_instance.position = get_global_position()
It’s supposed to instance a bullet at the gun’s position. bullet_instance is defined like so:
var bullet_instance = _ready()
Thank you in advance, especially since this is for a game jam
There is definitely some misunderstanding in the above code. First, the _ready()
function isn’t intended to be called by your code. It’s automatically called by the engine when the scene is, well, ready.
Further, the _ready()
function doesn’t return anything (it’s a void
function), so assigning its result to your bullet_instance
variable will certainly cause the variable to be null
, as indicated by the reported error.
Without more code, it’s difficult to provide additional assistance.
jgodfrey | 2022-08-24 14:36