GameMaker: Studio

GameMaker: Studio

Find, play, and make games easily
Discover, rate, and download the best player-created games made in GameMaker: Studio for free. Or try making your own and share with the community. Click here to learn more.
jolb 6 Jun, 2017 @ 8:47am
im a little confused on SPRINTING.
ok so im trying to make the player have a sprint animation but the problem is that when i let go of the "sprint" key while holding down the walk key ("D" or "A"), the player is still in the sprint animation untill i let go of the "D" or "A" key... can anyone help?


if (left){
x -= hspd; // Hspd starts out as 1
image_xscale = -1; // Havent made a walking animation yet.

if (sprint == true){ // Sprint key
sprite_index = spr_player_sprint;
image_speed = .3;
hspd = 2;

}}else if (right){

x += hspd;
image_xscale = 1

if (sprint == true){
sprite_index = spr_player_sprint;
image_speed = .3;
hspd = 2;

}}else {

hspd = 1;
sprite_index = spr_player;
}







Last edited by jolb; 6 Jun, 2017 @ 8:48am
< >
Showing 1-2 of 2 comments
melon king 4 6 Jun, 2017 @ 3:13pm 
Is there anything that triggers to make sprint = false again?
surreal 1 26 Jun, 2017 @ 12:27pm 
you should create a local var called sprinting;

var sprinting = keyboard_check(YOUR_SPRINT_KEY_HERE);

This will set sprinting to false when the key is not pressed.
< >
Showing 1-2 of 2 comments
Per page: 1530 50