Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Basic setup for GML top/down player control
if(keyboard_check(vk_nokey)) {
image_speed = 0;
}
if(keyboard_check(vk_left)) {
sprite_index = spr_right;
image_speed = 0.2;
image_xscale= 1;
x -= 4;
}
// Flip image (image_xscale) to save sprite animations
if(keyboard_check(vk_right)) {
sprite_index = spr_right;
image_speed = 0.2;
image_xscale= -1;
x += 4;
}
if(keyboard_check(vk_up)) {
sprite_index = spr_up;
image_speed = 0.2;
y -= 4;
}
if(keyboard_check(vk_down)) {
sprite_index = spr_down;
image_speed = 0.2;
y += 4;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.