Invalid get index 'gobal_position' (on base: 'Node2D').

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

I am trying to get object rotating with my mouse position.
extends KinematicBody2D

onready var weapon_base = $Weaponbase
export var move_speed = 100.0
export var gravity = 400
var velocity = Vector2()
export var jumpforce = 200.0

func _ready():

func _physics_process(delta):
	var move_dir = 0
	if Input.is_action_pressed("move_left"):
		move_dir -= 1
	if Input.is_action_pressed("move_right"):
		move_dir += 1
	if is_on_floor():
	if Input.is_action_just_pressed("jump") and is_on_floor():
		velocity.y -= jumpforce
	velocity.y += gravity * delta
	velocity.x = move_dir * move_speed

func point_weapon_at_mouse():
	var vec_mouse = get_global_mouse_position() - weapon_base.gobal_position
	weapon_base.global_rotation = atan2(vec_mouse.x, vec_mouse.y)

It is giving out an error

Invalid get index ‘gobal_position’ (on base: ‘Node2D’).
re read the code but cant find the flaw.

:bust_in_silhouette: Reply From: kidscancode

You’ve written gobal_position instead of global_position, on first line of point_weapon_at_mouse().