Parse Error: The method "get_global_postion" isn't declared in the current class.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Snazza

this is the full code

func fire():
var bullet_instance = bullet.instance()
bullet_instance.postion = get_global_postion()
bullet_instance.rotation_degrees = rotation_degrees
bullet_instance.apply_impulse(Vector2(), Vector2(bullet_speed,0).rotated(rotation))

someone please help. thanks

:bust_in_silhouette: Reply From: Gluon

The error message “isnt declared in the current class” means the type of node you have chosen doesnt have this property. A kinematic body would have this property for instance but a basic node wouldnt. What kind of node is your bullet made of?

:bust_in_silhouette: Reply From: AlexTheRegent

To fix your error, you need to change node’s script owner to Node2D or it’s descendants (and add extends Node2D as first line of your script) class.
get_global_position is defined in Node2D class. Based on your script, your node is extended from Reference (if your script has no extends keyword, then your script extends Reference).