playMaker

Author Topic: How to add Knockback to melee?  (Read 2321 times)

Frost

  • Playmaker Newbie
  • *
  • Posts: 16
How to add Knockback to melee?
« on: July 31, 2018, 06:59:36 PM »
Hello again PlayMaker forum! I been learning and practicing, now i know a lot more... but can still figure out something....

Please help me...

I am trying to hit an enemy with a melee attack and push the enemy a couple of meters away, then he stops. Like a knockback. This is the idea but i cant get it to work. Any idea on how to make a knockback work on PlayMaker?
« Last Edit: July 31, 2018, 07:32:40 PM by Frost »

nFighter

  • Beta Group
  • Full Member
  • *
  • Posts: 174
    • multiplayer adult fighting
Re: How to add Knockback to melee?
« Reply #1 on: July 31, 2018, 08:21:54 PM »
First of all it depends on how did you implement moving in your game: is it physics based, sprites, anything else...
indie developer of multiplayer adult fighting
http://nakedfighter3d.com

Frost

  • Playmaker Newbie
  • *
  • Posts: 16
Re: How to add Knockback to melee?
« Reply #2 on: July 31, 2018, 08:31:48 PM »
With Velocity2D and an xSpeed variable and Get Axis to define the variable. I hit the enemy with Velocity 2D and his own xSpeed with Every Frame marked but doesnt ever stops, keep going and going... i want him to stop and pursue the player again

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to add Knockback to melee?
« Reply #3 on: August 01, 2018, 02:42:17 AM »
Hi,

 you need to use AddForce and at the time of impact add a big amount of force ( probably set ot Impulse or velocity mode.

 Have you tried that?

 try first on a regular simple cube, then move up in complexity with a moving cube, then a proper ennemy.

 Bye,

 Jean

Frost

  • Playmaker Newbie
  • *
  • Posts: 16
Re: How to add Knockback to melee?
« Reply #4 on: August 02, 2018, 09:23:39 PM »
Thanks Jean, it sort of works now... thing is, that even with a variable with a very low value it goes extremely fast and doesnt seem to stop (looking as its position on the inspector). I cant get him to stop :(

Frost

  • Playmaker Newbie
  • *
  • Posts: 16
Re: How to add Knockback to melee?
« Reply #5 on: August 02, 2018, 10:44:52 PM »
Ok i finally did it. Thanks for the AddForce advice! THANKS!