I hope posting here isn't a faux pax, if it is please feel free to direct me to the correct location. Or, if there is a thread that already covered this I would love to be pointed in its direction.

I've tried looking in quite a few different forums and I can't seem to find very much information about this. What I'm looking to do is implement a whip weapon for a character that's similar to that of Castlevania 4's whip.

I have no idea where to start. I'm really just looking for any information. Things like how to program it, the idea of how it was done in the game, really just anything to help me figure out how to make a whip like Castlevania 4.

I would appreciate any help. Thank you.

  • \$\begingroup\$ I downvoted your question, because it seems to me you didn't put any effort in finding a solution. If you did though, please post your thoughts or concept, and let us know where you got stuck. \$\endgroup\$ – Marton Jul 18 '12 at 7:28
  • 1
    \$\begingroup\$ Google "2d spline collision" : gamedev.net/topic/… and "closest point to spline" gamedev.net/topic/…. Tinker with polynomal curve and spline for search in google to get the exact result. I bet you could find perfectly explained and pseudo-coded solution too after a while. Then you'll have to lay out points under your sprite to form the invisible collision object. And... ta-dah! \$\endgroup\$ – joltmode Jul 18 '12 at 12:07
  • \$\begingroup\$ There's the regular attack that extends out in various directions and the hold-the-button-to-flail behavior. Those very different and are likely governed by equally different rules/code. I assume since you cited CV4, you're mainly interested in the flailing/hook/swing mechanic? \$\endgroup\$ – chaosTechnician Jul 19 '12 at 3:49

I think most resources you find that have to deal with ropes will help you here. There is a lot of information about simulating ropes. For example:

2D Rope Collision Detection


Lightning whip particle effects


What are the maths behind 'Raiden 2' purple laser?

Since a whip is basically like a rope, I think these resources will help you. Good luck!


Often times you'll find that there doesn't exist information for exactly what it is you want to do on the internet.

But you can find tutorials for things that are close.

I imagine if you look for how to make platformers in Unity you'll get some useful results. Probably for metroidvania style games as well.

As for making a weapon with that particular behavior, that's going to be trickier. You'll need to decide what exactly happens when someone swings a whip like that, and determine how to represent it.

Programming in general is like this, but in video game programming especially you'll frequently come across vague, strange problems that are difficult to resolve. What you need to do is break things down define what it is you want to accomplish.

This is part of why I suggested looking at some tutorials. That will give you some context. While this might not even help you determine how to implement your desired feature? You'll have a better idea of how to ask for help.

If on the other hand you already did do all that and are just really uncertain of how to represent a whip that bounces all over the place? Frankly I don't blame you. That's a difficult problem.

There's a few ways I think you could go with this, so I'd say the first thing to do is settle on and visualize the specific way in which you want the whip to work.

Probably your answer is to use several hit boxes. Make an approximation of a flailing morning star.

Sorry if my answer is a bit long and rambling.


Having happened across your cross posting of this question on Reddit, it looks like you're just interested in determining the movement for the whip in "dangle" (and possibly also "flail" mode). The term you want to hunt for is Forward Kinematics (Complimentary links: Wikipedia, Some less complex math site).

Essentially, each section of the whip has a length and an rotation. For any link, n, after the first, its position is determined as being n-1's length away in the direction of the n-1's rotation. Start at the handle of the whip and determine locations of each section in turn down to the end of the whip.

Setting how much a link can rotate each tick is up to you and your desired physics outcome.


castlevania's is fairly simple, I would create a spritesheet of the whip extending and use an animation class to play it in game and simply extended the bounding rectangle by the size of the whip each frame and ensure that the handle is is the same position as the players hand

  • \$\begingroup\$ Super Castlevania 4's whip is quite different from the one in the previous installments. Instead of whipping straight forward, it can whip in arbitrary directions and consists of multiple linked segments, which can be manipulated by flailing around. \$\endgroup\$ – Lars Viklund Jul 18 '12 at 8:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.