Hi there,
As stated, I'm new to programming/Godot, but have gone through various tutorials. I have a decent grasp (i think) of things, but am struggling with what I'm trying to accomplish. I have my Player scene where I move with WASD, and I have a Pistol scene, that I would like to move independently around a point on my Player scene. Most tutorials I come across have the mouse rotating the entire object, which is not what I'm going for, similar to how Geometry Wars or Enter The Gungeon work.
On my Pistol scene, do I use get_parent in the script and then put everything in the Player script?
For the Player script, I found a different post, but wasn't able to make it work for me. This is what I have right now:
Note: I am focusing on getting the rotation right first, but will eventually like to make it so that if the Pistol goes past -90 or 90 degrees, it flips the Player sprite, that's why it's commented out for now:
var mouse_position = Vector2()
var gun_position = Vector2()
var rotation_between
func _physics_process(delta):
........
.......
aim_gun()
func aim_gun():
mouse_position = get_global_mouse_position()
gun_position = global_position
look_at(get_global_mouse_position())
rotation_between = rad2deg((mouse_position - gun_position).angle())
#if (rotation_between >= -90 and rotation_between <=90):
#$icon.flip_v = false
#else:
#$icon.flip_v = true