H
Hajbiz
Guest
I'm creating a top down dungeon crawler game. I have 4 way directional movement, with up, down, left, and right. Each direction has it's own animation for walking. In this game you shoot enemies. I am trying to set up a shoot animation so that if the sprite is the left sprite and space is pressed it plays the left shoot animation, if the up walk sprite is active and I press space the up shoot animation, and so on. However I can't get my code working. I'm rather new to GML I tried this on a step event.
if !(keyboard_check_pressed(ord("vk_space"))) && !(keyboard_check_pressed(ord("vk_left"))) sprite_index = sp_shoot_l
if !(keyboard_check_pressed(ord("vk_space"))) && !(keyboard_check_pressed(ord("vk_right"))) sprite_index = sp_shoot_r
if !(keyboard_check_pressed(ord("vk_space"))) && !(keyboard_check_pressed(ord("vk_up"))) sprite_index = sp_shoot_u
if !(keyboard_check_pressed(ord("vk_space"))) && !(keyboard_check_pressed(ord("vk_down"))) sprite_index = sp_shoot_d
Thank you to those who help.
if !(keyboard_check_pressed(ord("vk_space"))) && !(keyboard_check_pressed(ord("vk_left"))) sprite_index = sp_shoot_l
if !(keyboard_check_pressed(ord("vk_space"))) && !(keyboard_check_pressed(ord("vk_right"))) sprite_index = sp_shoot_r
if !(keyboard_check_pressed(ord("vk_space"))) && !(keyboard_check_pressed(ord("vk_up"))) sprite_index = sp_shoot_u
if !(keyboard_check_pressed(ord("vk_space"))) && !(keyboard_check_pressed(ord("vk_down"))) sprite_index = sp_shoot_d
Thank you to those who help.