C
chimericalCharlatan
Guest
I'm relatively new to GML, so bear with me. I'm coding my player's movement/animation etc etc but the problem is, while the player moves and switches to the correct sprite according to the key pressed, the sprite doesn't actually animate. I know I'm doing something wrong but I'm not sure what. Here's my code:
Code:
if keyboard_check(vk_left) x -= 2
if keyboard_check(vk_right) x += 2
if keyboard_check(vk_up) y -= 2
if keyboard_check(vk_down) y += 2
if keyboard_check_pressed(vk_left)
sprite_index = spr_player_l
global.moving = true
if keyboard_check_pressed(vk_right)
sprite_index = spr_player_r
global.moving = true
if keyboard_check_pressed(vk_up)
sprite_index = spr_player_b
global.moving = true
if keyboard_check_pressed(vk_down)
sprite_index = spr_player_f
global.moving = true
if keyboard_check_released(vk_left)
global.moving = false
if keyboard_check_released(vk_right)
global.moving = false
if keyboard_check_released(vk_up)
global.moving = false
if keyboard_check_released(vk_down)
global.moving = false
if global.moving = true
image_speed = 0.2
if global.moving = false
image_index = 0
image_speed = 0