- Home /
Super Smash Bros Styled Game animators and hitboxes
Hello people, I have two questions, to which I need some answers quickly, and without posting much of the code here I go:
While making the attack animation conditions being met if i spam the attack button, the attack animation gets repeated for as long as i click twice during the animation. (This animation is a dummy animation i created in unity that has a 1 second duration) However, in the code I wrote i have this:
if (!isAttacking) { if (Input.GetButtonDown("Normal Attack")) { isAttacking = true; currAttackType = 0; animator.SetBool("attacking", true); } else if (Input.GetButtonDown("Special Attack")) { isAttacking = true; currAttackType = 1; animator.SetBool("attacking", true); } } if (!animator.GetBool("attacking") && isAttacking) { isAttacking = false; }
The second if was to try and prevent the bug from happening but it doesn't. The structure of it is basically at the end of the animation i have an event that calls a function that resets the isAttacking flag along with the animator flag as well. Was wondering if you have any ideas at all. And if needs be I'll post the whole code.
The hitboxes for now are just basic cubes colored according to the moves type, with a script attached to each of them that places them in the correct position. Then i have two arrays of GameObjects on the character that hold those moves. The question is if there is a more effient/better way to do this, of is this is just another possibility in the endless spectrum of existing ones.
Also, I'm doing the game by myself including 3D models and textures so for now I'm mostly dedicating myself to the programming part of it.
Your answer