Helping with sidescroller attack method

I am trying to create a sidescroller where the hero has a sword on a chain that he throws out and then snaps back to him, but I'm having an issue with the logic of that.

Does anyone have any examples or any hints on how to make an extendable chain affect?

For instance... the hero would start out:

H

Then hit attack

H=|>

And it would extend

H======|>

And then snap back

H===|>

Where H is the hero and = is the chain and |> is the sword

Any ideas?

Comments

  • TosanuTosanu Member, PRO Posts: 388

    first, you need to create a pair of Global attributes to constrain to the X and Y coordinates of the player. These are crucial for making weapons that stay attached to the player.

    Id say for the collision you just want to make a small invisible box the size of the sword itself, and leave off the chain for collision, unless its a VERY long chain. You would want to spawn a large transparent box to animate the full motion to constrain to that action.

    What you do is spawn the attack, constrain its Y coordinate to the PlayerY coordinate, and Change its x attribute to where it would start, like PlayerX+20, if it starts in front of the player.

    You then interpolate its movement to Player X + Full range over a length of However many seconds you want it to last. If the attack returns immediately, put a timer of "length of original interpolation" with an interpolation command inside to return to playerx+ original distance. This will create a square that snaps out and then retracts at whatever speed and distance you want. That is your damage box.

    As i noted, you are best off then creating a non colliding actor that is the size of the entire chain and sword maximum length, and animate the sword's action on a transparant background to match the movement of the collision box.

  • ookami007ookami007 Member Posts: 581

    Thanks! I'm not sure I fully understand what you mean, but maybe I can play around until I figure it out!

  • TosanuTosanu Member, PRO Posts: 388

    I was a bit rushed. Tell me what parts youre most confused about and ill be glad to explain further (i dont have the resources to make demos, sorry)

  • MichalChMichalCh Member, PRO Posts: 115

    I Suggest as I did a lot of times use sin function, as you should know sin has values from -1 to +1. Making it abs() makes it from 0 to 1 to 0 and again to 1 value. U can use Sword.SelfTime to operate how you want it to go (inside the sin{}). It would be only for sword because chain would look bad being stretched. For chain i suggest according also to Sword.SelfTime to add chain actors and then delete them as sword comes back.

    Regards

  • ookami007ookami007 Member Posts: 581

    Why wouldn't you just increase the width of the chain and set the tiled property? Then the chain tiler the "chain" portion of it?

    I'm not sure what you mean by using SIN for the sword though.

Sign In or Register to comment.