YesNoOk
avatar

hitdef sparkxy pos problem/question (Read 30653 times)

Started by Odb718, February 12, 2013, 12:48:56 pm
Share this topic:
Re: hitdef sparkxy pos problem/question
#21  February 17, 2013, 05:15:38 am
  • *****
  • Shame on you!
    • USA
Cyanide, there's clearly a miscommunication. I dont feel I've asked about collision boxes at all.

I figured there should be a way to figure out the width because the game can push you away from the walls using it. my bad. That's all I wanted to know at this point.
vVv N00bSaibot & Muramasa RoofTop vVv
Re: hitdef sparkxy pos problem/question
#22  February 17, 2013, 06:16:26 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
No, but part of your problem is that you're worried about what happens when an extended limb hits an extended limb.

You have proven from your tests that you can't see width applied through the width controller. As you cannot do this, there is no point worrying about anything else because the best you're ever going to get is p2bodydist X.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.
Re: hitdef sparkxy pos problem/question
#23  September 19, 2024, 02:23:10 am
  • avatar
    • Canada
wow, ok, so sorry for necroing this thread insanely hard but this is possibly the least productive programming thread i have ever seen on a mugen forum, especially for a problem so simple. it baffled me to the extent that i decided to make an account and reply with my own solution to this problem, one that seems much simpler to me and doesn't require any if-elses or additional code beyond the sparkxy. idk if this will help anyone, but here i am over a decade and a half later looking for some help on coding this, so maybe it will.

the basics of this problem is that, when the x is tied to p2, it makes hitting them from farther away (such as from an extended hurtbox) look really strange. you can pretty easily make the x rely on p1's position by doing p2dist x subtracted by an offset, but then you run into the issue that if you hit the opponent close up, the spark will go past the opponent or offscreen if they're in the corner.

instead, what you need is a simple math equation to get a "range" of the where the spark should appear, ideally somewhere along the move's hitbox or character's limb.
for a jab, a basic equation would look like this:
Code:
sparkxy = 5*(p2bodydist x*0.1),-60



this simply adds a bit more distance to the hitspark if done a bit farther away, but it will always show up on a spot around p1's limb since it's multiplied by 0.1.

for a longer move, you'll have to multiply the bodydist even smaller, like this:
Code:
sparkxy = 30*(p2bodydist x*0.01),-90