Sword-surfing definitely looks like a feature to me!
But seriously, that was quick! And I'm not quite sure what aspect here is buggy, as I don't know what you were trying to accomplish in the gif. What should have happened here?
It's more like "buggy." I apply a velocity to the sword to "throw" using the right stick's direction and a constant. You're not supposed to be able to be able to keep applying that force after the initial throw.
It is an interesting mechanic though, especially since you have to balance on top of it. That's what I was showing. It could be an ability you unlock later in the game, complete sword control on a timer or something.
Yeah, I think maybe you should have two explicit states on your character (or on the sword, I'm not sure what makes more sense): holding sword and not holding sword (if the state's on the sword, then held or not held).
You can only apply force to the sword when holding sword is true. After throwing, holding is false. It's true again when the player collides with the sword. However, you should give a brief window for the player and sword's respective hitboxes to separate before detecting a collision.
But I really like that idea for a special ability or something.
I did take your state ideas and it works.
For your "The sword could end up in a place that you can’t zip to and retrieve" issue, I was thinking of adding a button that just summons the sword back to you if you lose it/throw it in a tough spot.
A summon button makes a lot of sense.
Were you thinking that the sword would fly back in your hand, or more of a teleport thing? Maybe I'm jumping too far ahead.
I was thinking teleport. The sword flying towards him probably wouldn't gel with the whole boy not strong enough to pull the sword towards him thing.
Oh duh, gotta be consistent of course!
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.