Skip to content

Instantly share code, notes, and snippets.

@DanBradbury
Created July 24, 2014 07:06
Show Gist options
  • Save DanBradbury/e6be101912d40b4aabaa to your computer and use it in GitHub Desktop.
Save DanBradbury/e6be101912d40b4aabaa to your computer and use it in GitHub Desktop.

MOVE_SPEED = 4;
WALK_SPEED = 10;

if(keyboard_check(vk_up)){
    y -= MOVE_SPEED;
    sprite_index = spr_player_up;
    image_speed = WALK_SPEED;
}else if(keyboard_check(vk_down)){
    y += MOVE_SPEED;
    sprite_index = spr_player_down;
    image_speed = WALK_SPEED;
}else if(keyboard_check(vk_right)){
    x += MOVE_SPEED;
    sprite_index = spr_player_right;
    image_speed = WALK_SPEED;
}else if(keyboard_check(vk_left)){
    x -= MOVE_SPEED;
    sprite_index = spr_player_left;
    image_speed = WALK_SPEED;
}else{
    image_index = 0;
    image_speed = 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment