- Home /
Duplicate Question
Castlevania style stop and attack script.
I have searched and searched the forums and I have seen a few about castlevania 4 whip animation and collision here and there, but this is different. Probably a much simpler question, hopefully with a much simpler answer.
Yes I am new to using Sprite Manager 2 and Yes, new to using Unity as well. I've been working on a prototype for a game that is like a metroid-vania with Dark Souls style death treatment. Don't ask, I like to punish people I guess haha.
ANYWAYS! So... I have a punching animation, works standing still, but while running it doesn't play. I put a 'print ("ATTACK RIGHT");' and also for left to show that the attack is technically happening. But how do I stop the player from moving... and then play the animation?? I hate to be such a noob, but you have to start somewhere. I would appreciate any help from anyone. I may just be overlooking or overthinking this. I need an outsider opinion!!
Thanks in advance! Let me know what else you need in terms of info.
I have that variable "var attack : boolean = false;" outside the update (). So I have it only playable while it's false, because during the attack it's true so i figured that would stop it from being spammable? Maybe I need a WaitForSeconds()??? I dunno!!
This is all in my Update();
//punch right
if (Input.GetButtonDown("Attack") && moveDirection == 1 && velocity.x == 0)
{
attack = true;
Sprite.DoAnim(8);
print ("ATTACK RIGHT");
}
//punch left
if (Input.GetButtonDown("Attack") && moveDirection == 0 && velocity.x == 0)
{
attack = true;
Sprite.DoAnim(9);
print ("ATTACK LEFT");
}
//running punch right
if (Input.GetButtonDown("Attack") && moveDirection == 1 && velocity.x > 0)
{
attack = true;
Sprite.DoAnim(8);
print ("ATTACK RIGHT WHILE RUNNING");
}
//running punch left
if (Input.GetButtonDown("Attack") && moveDirection == 0 && velocity.x < 0)
{
attack = true;
Sprite.DoAnim(9);
print ("ATTACK LEFT WHILE RUNNING");
}
this one's a dupe, people will answer your other question, cheers
Follow this Question
Related Questions
Stop player movement and play attack animation 0 Answers
Wait for animation end - Sprite Manager 2 1 Answer
Random attack animation 1 Answer