G
Gowford
Guest
Hello ! first of all i want to just tell my problem and what it is .
it's not really something i'm too familiar with but it's something i did just today and it works fine if you don't take into account the massive bug that happens .
the bug is that when you attack , the character stops to attack , but the problem is that if you attack right after you take damage you get launched accross the room until you either hit an solid object or the dangerous water hazard .
here's the code i use for both the attacking part (so it recognizes that it's attacking) and the movement code.(if needed i WILL give out the friction code if needed , because there is one , the problem is i didn't do this , my friend did , so the friction is something i don't mess around with because i dunno how to turn it back on
//LR movement
if (!attacking){
if(sprite_index!=spr_roll){
move = key_left+key_right;
hsp = move * movespeed ;
if(hsp!=0){
if(alarm[2]!=-1){
sprite_index=spr_idle;
alarm[2]=-1;
}
}
}
}
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
//Attacking recognition
if(sprite_index==spr_attack||sprite_index==spr_attack2||sprite_index=spr_attack3){
if(!attacking)
attacking=true
}else{
attacking = false}
it's not really something i'm too familiar with but it's something i did just today and it works fine if you don't take into account the massive bug that happens .
the bug is that when you attack , the character stops to attack , but the problem is that if you attack right after you take damage you get launched accross the room until you either hit an solid object or the dangerous water hazard .
here's the code i use for both the attacking part (so it recognizes that it's attacking) and the movement code.(if needed i WILL give out the friction code if needed , because there is one , the problem is i didn't do this , my friend did , so the friction is something i don't mess around with because i dunno how to turn it back on
//LR movement
if (!attacking){
if(sprite_index!=spr_roll){
move = key_left+key_right;
hsp = move * movespeed ;
if(hsp!=0){
if(alarm[2]!=-1){
sprite_index=spr_idle;
alarm[2]=-1;
}
}
}
}
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
//Attacking recognition
if(sprite_index==spr_attack||sprite_index==spr_attack2||sprite_index=spr_attack3){
if(!attacking)
attacking=true
}else{
attacking = false}