I have basically overhauled the attack system
How it works
First, the attack is done by setting this.atk to an array
What does each index mean?
0 - The attack id, only for animation (in the future), and if it’s 0 then nothing happens
1 - The state, set it to whatever you want it to start as, and it increases by 1 each frame
2 - The end state, when the state reaches this number, it ends the attack completely
3 - The start function (requires a parameter to input the player object, since it operates on a different scope and is unable to access it without it). It runs when the state reaches 0, and you can make it negative to have a delay to the attack
4 - The update function, runs every frame while the state is >0
5+ - any extra array indices can be used to store extra data about the attack that you don’t want to make a specific variable for.
Funny Fighters11-27-2023_12-25-00.wick (39.2 KB)