I want the object “sword” rotate 360 degrees everytime the player press mouse button.
When the mouse button pressed, the sword rotate. But when I press once again, it does not move.
I want use the sword as the main weapon.
Why does this happen?
I’m pretty sure the problem is that once it’s tweened to 360 degrees, it then remains at 360 degrees. So trying to tween the object to 360 degrees again has no effect because it’s already there. You could do something like tween to 180, wait 0.5 seconds, tween to 0, and achieve a similar effect, and it would then work correctly.
There are a few issues here:
- You need to remove an existing tween before you apply it again.
- You have an unconditional tween (“follow mouse”), moving it to the cursor. This creates a tween on the object every frame, and will cause issues. Search for the smooth camera movement on how to move something to a moving target using the lerp command.
- As @weadsy1 wrote, you’re tweening to 360, and then it stays there. To fix this, first add an action to remove the tween “attack”. Then you have a choice - either tween to sword angle() + 360, or set the sword angle to 0 and then tween to 360.
Thank you. I added remove tween and set sword angle 0, then it’s solved
Thank you, it was very helpful.