x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How can i implement melee damage with paper2d?

I've spent several months trying to get my characters to do melee damage. I have all of my animations down. Monsters can do damage to me on touch, but the only way I've been able to get my characters to do damage is with projectiles. What I'm wanting is damage that follows the structure of a sword or mac. I've tried using timeline but I can't seem to understand how to properly use it with a time line, nor can I figure out how to attach collision boxes to just a few frames of a character with or without sockets. Could somebody please give me some more ideas to run with?

Product Version: Not Selected
Tags:
more ▼

asked Mar 29 '15 at 05:51 PM in Blueprint Scripting

avatar image

Kinekon
6 1 4 5

avatar image Kinekon Mar 31 '15 at 06:48 PM

I've seen lots of people looking for answers to this question. And I've seen a few who had done it. But I can't seem to find anyone who found answers other than those who figured it out themselves and even then it's been quite some time since those people have been on AnswerHUB. Still trying to figure it out myself, and If/When I do I will certainly post here how I came to make this work so that others won't spend as long as I have trying to find a solution. Hopefully someone who already has figured this out might lend some advice though? =)

avatar image Kinekon Apr 12 '15 at 10:55 PM

Anyone? Only thing I've come up with is a projectile movement component that fires in time with my animation with a lifespan of 0. Is there a better way to pull this off or a way to make that movement trace an animation?

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Super late, but better late than never ;)

There are many options you can use, most of which I probably do not know. However it's working fine for me the way I'm doing it, even if it's not the best.

I'm having trouble understanding what your issue is (how would you use timelines for this? that doesn't make sense to me. Only thing I used timelines for was sending the actor on the other end flying when struck). You could just use the already implemented per-frame collision built into paper2d. Just go into the flipbook and set the setting there.

Alternatively, you could do 3D box collisions like I am doing for my game since it is technically 3D.

Here's a .GIF of the game:

alt text

That barely took me any time to implement. What I did was make a macro for each attack, and use that whenever my character attacks. The combo system is a different thing, but if you'd like me to explain that too then comment on that and I'll do my best (not that hard).

So I made a function titled "Hitbox Adjuster" which when called resizes the collision box I setup around my player. This function is then called from within the macro to set the collision box's size depending on what attack is occurring.

Here's how simple it is:

alt text

In my case the Z isn't changing, which is why it'll always be 32.

Something I did was create an array with the actors that are currently overlapping that collision box. That way in my attack event/function I can loop through that array and apply the damage or whatnot to those actors. I then created an array of classes that my actor can hit when he slashes, and then I check if the overlapping actor belongs to any of those classes before adding them. And make sure to check that the object isn't there already, as it might be added to the array twice and when the loop occurs it could trigger the events twice for that actor.

Here's what it looks like:

alt text

I also created my own macro to detect when an animation has reached it's end (and a few other options) by having it compare the current flipbook frame to the flipbook frame length every .01 seconds.

Then, I create a few variables titled "IsAttacking", "CanAttack", "IsAnimationPlaying", etc. So here's how it would work in my case (dumbed down, but you'll get the basis):

Key Pressed -> Turn Animation Looping Off -> Wait for Animation End -> Set "IsAttacking" To On -> Set "IsAnimationPlaying" To On -> Update Animation (animation state) -> Attack Stuff.

I don't know if I was clear enough, so let me know if I can help with anything else.

more ▼

answered Jul 27 '15 at 05:46 AM

avatar image

jfaztk
326 45 62 72

avatar image spudfkx Sep 16 '15 at 03:31 AM

paragonx9, it would be awesome if you could share how you implemented your combo mechanics.

avatar image Kinekon May 28 '16 at 08:12 PM

Wow, yeah, I had eventually given up and worked on other projects. I've just recently gotten back into the swing of things. I suppose I wasn't understanding enough of the basic mechanics of 2d. I have gotten a lot farther now though, and I'm loving the way you did this. The combo system looks nice, and I can't wait to get home and try this. Thank you so much paragonx9!

avatar image KevLee Aug 22 '16 at 04:23 AM

ParagonX9. I know that this is an old posting, but I was wondering if you could post the example that you created for the melee so we could see all of the variable and marco's that you created for the above example. Thanks

avatar image LoN Feb 17 '17 at 02:11 PM

ParagonX9. I never thought i would see another person use Zero. You are awesome!

Can you please explain into more detail the combo and the collision system you've made? It's really interesting.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question