I like the idea, cool game! Do you happen to have a link or guide to how you achieved the effect of the staff following the mouse cursor around the character? Very crisp and smooth animations, nice work
Viewing post in Soul Slime jam comments
Thanks! Added a StaffSprite as a Sprite2D and the following code. I might be missing something but this should be the majority of the code.
@onready var staff_sprite: Sprite2D = $StaffSprite
var aim_direction := Vector2.RIGHT
func _physics_process(delta: float) -> void:
var mouse_pos = get_global_mouse_position()
aim_direction = (mouse_pos - global_position).normalized()
func _process(delta: float) -> void:
var body_center_offset = Vector2(0, -8) # center of player body
var line_length = 20
var cut_off = 12 #i started with a red line at first, not sure if cut_off and line_length ended up being used for the final code
# Position the wand along the aim direction
var wand_offset = body_center_offset + aim_direction * line_length
staff_sprite.global_position = global_position + wand_offset
# Rotate the wand aroudn the player to face the aim direction
staff_sprite.global_rotation = aim_direction.angle() + deg_to_rad(45) # I rotated the rotation by 45deg to match the true direction