How to create a stable weapon system

Godot 4.3

hey, I want to create a system in my 2d pixel art game where player holds sword and shield, left click to attack and right click to defend himself by raising his shield. The problem is I don’t want to create this for only one weapon and shield. Later in the game I want the weapon and shield to be swapped. I have empty animations for raising the shield and swinging his hand. How can I put sword and shield and make the animation re usable? basically I want character to hold his weapon and shield in idle position and running, when it comes to left or right click, I want it to take action. but once player changes his weapons I want to reuse the same empty animations so I wont have to draw animations hundreds of times.

AnimationPlayers can operate on a new parent Node2D to your weapon/shield, then it won’t matter what childed weapon the Node2D has it will animate the same.

since I am new to godot this is hard for me follow. So you are saying I should use animationplayer and make node2d child of it, is this the solution?

The AnimationPlayer doesn’t have a transform or visibility so it’s best if it doesn’t have children. And the AnimationPlayer can be a child of most anything and function the same.

With a scene tree like this you can animate the Marker2D and swap out the WeaponSprite

1 Like

Thank you!