Particle Effect for Melee Attack
Hey guys, I am sort of lost with this. I worked all day on getting my melee attack and it finally works. Basically I set up my attack animation properly and everything animation wise works fine when, in my case, pressing E for right now.
//NEW ATTACK TRYOUT
if (Input.GetKeyDown (KeyCode.E)) {
attack = true;
}
if (attack && isGrounded) {
myAnim.SetTrigger ("Attack");
}
if (attack && isJumping) {
myAnim.SetTrigger ("Attack");
}
attack = false;
axCollider.SetActive (false);
The reason I am setting the axCollider to false, is because I created an emptyGameObject under player, to which I attached an EdgeCollider2D, which damages the enemies. I then made a function:
public void MeleeAttack(){
axCollider.SetActive (true);
}
This MeleeAttack function is attached to my animation, about the middle attack animation sprite. So it activates the EdgeCollider2D when my ax on the character comes back down. This seems to be working alright. But here is the problem, which I will show on the following screenshot. The player sprite that I am using is pretty decent, but the attack animation is just very close to the player unfortunately, so it gives the effect that he is not even reaching on his attack. This gives an optical illusion that you are far enough away from an enemy to hit and not get damaged, but most of the time when I play test, I get damaged because I press E too late.
So I figured, maybe a solution would be to create a particle effect, or maybe some sort of effect that makes it plausible for me to increase the EdgeCollider2D for my melee attack, so I can damage enemies from a little further away.
As you can see, my MeleeAttack function is called on that down swing of the ax, but that is usually too late and the enemy gets too close, so you still kill the spider for example, but you still get damaged, because the enemy got too close at that point. To fix this, I am possibly trying to give the effect that my little viking is maybe striking the ground and the force of it kills the enemy within this EdgeCollider2D. I am definitely up for suggestions on fixing the issue I am having. But the idea that I have with creating this "force" or energy that is released and which kills the enemy has me lost. I don't have any idea how to even create a visual effect like this. I was imaging maybe something like shown in the picture below.
Your answer
Follow this Question
Related Questions
"Spherize" rotation of particles 1 Answer
VFX Particles doesnt appear 0 Answers
Preload a scene which will be shown after the next scene 0 Answers
2D AI movement 0 Answers
How to set direction to a random point on camera viewport? 0 Answers