- Edited
Hello !
I’m new to this engine and I’m having a issue with the look_at() function.
I’m trying to make the player shoot a bullet in direction of the cursor
This is my code for the bullet :
extends Area2D
@export var SPEED := 5000
var movement_vector := Vector2(0,-1)
func _ready():
look_at(get_local_mouse_position())
func _physics_process(delta):
global_position += (movement_vector.rotated(rotation) * SPEED * delta)
And my code to shoot it (inside player scene) :
##SHOOT
if Input.is_action_just_pressed("shoot"):
var bullet_instance = bullet.instantiate()
get_parent().add_child(bullet_instance)
But the bullet is not going where the cursor is
(if you can please help locate the bullet too :slight_smile: )