Lance Klepp
Member
Is there a gml function that'll work with keyboard inputs so that if the user just taps the right key for example, the player animation will run one sprite animation that accommodates for the short frame length, and then if that same key is held for a duration of time, a different animation sprite is used instead?
I only ask because I don't know what to search for as I can't think what to call this ha.
The purpose behind this is because my player object is a guy in a wheelchair I'd like to achieve small movements with one animation and longer movements with a different animation.
So the logic would be something like
Say the player sprite pixel size is 32x32, 1/4 would be 8 pixels. So if moving right will be greater than 8 pixels ... And so on.
I was able to speed up the same animation of the normal movement when the movement speed increased, such as holding the shift key. I've created a new animation for short distances, like one tap of the key sort of distances. Basically three frames of animation instead of 8.
So even a tap of the key would force the player to move 3 frames of distance as obviously I could get less than 1 frame if I'm tapping super quick.
If it isn't a gml function per say I'm guessing some sort of timer variable or a variable that counts pixel movement from point a to point b. Or if I can choose 3 frames out of the 8 total frames in the sprite to animate only, that would mean I could remove the short animation sprite. Choices choices haha.
As usual not after spoonfed answers just some helpful guidance
I only ask because I don't know what to search for as I can't think what to call this ha.
The purpose behind this is because my player object is a guy in a wheelchair I'd like to achieve small movements with one animation and longer movements with a different animation.
So the logic would be something like
Code:
If (keyboard_check(vk_right) is held
for more than 1/4 of the sprite pixel size {
sprite_index = sprite long animation
} else {sprite_index = sprite short animation;}
I was able to speed up the same animation of the normal movement when the movement speed increased, such as holding the shift key. I've created a new animation for short distances, like one tap of the key sort of distances. Basically three frames of animation instead of 8.
So even a tap of the key would force the player to move 3 frames of distance as obviously I could get less than 1 frame if I'm tapping super quick.
If it isn't a gml function per say I'm guessing some sort of timer variable or a variable that counts pixel movement from point a to point b. Or if I can choose 3 frames out of the 8 total frames in the sprite to animate only, that would mean I could remove the short animation sprite. Choices choices haha.
As usual not after spoonfed answers just some helpful guidance
Last edited: