Get a sword to swing when Z is pressed

How do I…

This is the third forum post i have made regarding the same game. I have a sword (below) which snaps to the player and flips horizontally depending on which way the player is facing. I have tried multiple times and failed, to make it so when Z is pressed, the sword rotates 180 degrees and back to its original angle. Of course, if the sword is flipped horizontally, the sword should swing the other way.

Related screenshots



Can you describe (or better yet) show us a video of what actually happens instead? Your events would especially be helpful as well.

I dont have any events. I just don’t know how i would go about doing this, as i have no clue.

Where is it’s pivot point? Does it spin 180 where it is, rotating at the handle? At the centre of the blade? At the blade point? Around the player?

You need to describe it better. I imagine it circling the player, which I don’t think is what you’re after.

Pivot point is the handle. (the image was from the pickup object)

Change the centre point of the sword to where you want it to rotate.

Add the behaviour “Tween” to the sword object.

when z is pressed, start an angle tween to 180.

When that tween has finished playing, tween the angle once more to 0.

Like this: