can you please make one topic for your problems, they are all related to the same piece of code...
anyway, what happens here is that when you press z, in one frame it think you are already doing the second punch, and when it comes to secondpunch, it immediatly jumps back to idle...
I havent tested the following, but should atleast get you started:
if (my.STATE == 1)
{
my.ANIMATION += 10 * time_step;
ent_animate(my, "idle", my.ANIMATION, ANM_CYCLE);
if (key_cur - key_cul)
{
my.ANIMATION = 0;
my.STATE = 2;
}
if(key_z)
{
my.ANIMATION = 0;
my.STATE = 4;
}
}
if(my.STATE == 4)
{
while(my.ANIMATION < 99) {
my.ANIMATION += 10 * time_step;
ent_animate(my, "firstpunch", my.ANIMATION, ANM_CYCLE);
wait(1);
}
if(key_z)
{
my.ANIMATION = 0;
my.STATE = 5;
}
else
{
my.ANIMATION = 0;
my.STATE = 1;
}
}
if(my.STATE == 5)
{
while(my.ANIMATION < 99) {
my.ANIMATION += 10 * time_step;
ent_animate(my, "secondpunch", my.ANIMATION, ANM_CYCLE);
wait(1);
}
my.ANIMATION = 0;
my.STATE = 1;
}
2 things; if you hold z, it will also already do 2 punches (in a row though
![laugh laugh](/ubb7/images/graemlins/default_dark/laugh.gif)
), and, it stops your player from doing anything but animate while punching...
again, this is only a rough start, and nowhere near pretty code... good luck with this.
regards,