H
Hyteel
Guest
Hi, I am working on an animation-system and have a very small amount of code related to it currently. But I have managed to come across a very unusual problem. My code (Client):
and (scAnimationHandler) :
If I do any keyboard input CurrentAnimation becomes 1.
Everything works properly if I tap the keys, ie. AnimationFrame changes to 1 after going above 3
But if I hold down a key, even though the script is called, AnimationFrame goes above 3 (show_debug_message(Animation) in Script)
I am almost 100% certain it has nothing to do with the code controlling movement and it is 230 lines of code long so pasting it here would just cause more harm than good. Thanks for taking your time to read this!
GML:
//Animation
CurrentAnimationFrame += 1;
var ReturnedValue = scAnimationHandler(CurrentAnimation, CurrentAnimationFrame);
if (ReturnedValue == 0)
{
image_index = ReturnedValue;
CurrentAnimationFrame = 0
}
else
{
image_index = ReturnedValue;
}
GML:
//Inputs
Animation = argument0;
AnimationFrame = argument1;
//Outputs
//Idle
if (Animation = 0)
{
return 0;
}
//Walkinganimation [Upper]
if (Animation = 1)
{
if (AnimationFrame == 1)
{
return 1;
}
else if (AnimationFrame == 2)
{
return 2;
}
else if (AnimationFrame == 3)
{
return 3;
}
else if (AnimationFrame > 3)
{
AnimationFrame = 1
return 1;
}
}
Everything works properly if I tap the keys, ie. AnimationFrame changes to 1 after going above 3
But if I hold down a key, even though the script is called, AnimationFrame goes above 3 (show_debug_message(Animation) in Script)
I am almost 100% certain it has nothing to do with the code controlling movement and it is 230 lines of code long so pasting it here would just cause more harm than good. Thanks for taking your time to read this!