Lunge()
verb
if(!usr.stunned)
usr.charging = 1 //variable to call damage upon bumping to another mob
speed = 20 //atom speed variable
walk(usr,usr.dir) //Lunge Effect
spawn(30)
usr.charging = 0 //reset to stop bump damage
walk(usr,0) //Stop Lunge
speed = 8 //reset to original speed
Problem description:
I'm probably overthinking this, but I'm struggling to gather my thoughts on how to create this effect. What are other alternative ways I can do it? I've sought through the dev lib didn't see much info.
- Who is being knocked back
- Direction of the knockback
- Distance of the knockback
This could be further detailed into whether they stop on dense objects, or destroy them and continue going (DBZ style), and whatnot, but that's up to you. MOST games have you stop on dense collision.
Pseudocode
Lunging/Dashing is generally the same principle, except you'd want them going in the direction they are facing rather than whatever direction the source of the knockback is facing.
I should mention that you can (and should) play with the sleep delay to get a smooth and visually appealing knockback/lunge effect. I believe animate() and/or flick() is used for anything flashy during the knockback/dash effects.