My sprite animation isn't working



So I am trying to create this game in a physics world.. and although , the moving and standing animation is working, the punching animation isn't.. it doesn't do anything.. it just remains stuck there.. although while moving the player, if i press the button for punching it kinda works.. but I want it to properly work while i am standing.. Before, I used to make games on non-physics world and use some scriptes made by a friend that had some pre-defined values for hspeed or vspeed so all i had to do was write this code for making the animation work while standing which was something like this:
  1. if(!keyboard_check(vk_right) && !keyboard_check(vk_left) && !keyboard_check(vk_up) && !keyboard_check(vk_down) && sprite_index!=spr_player_attack && sprite_index!=spr_player_attack3){
  2. image_speed=12;
  3. sprite_index=spr_player_stand;
  4. }
..but now that i am not using those scripts or hspeed/vspeed at all.. IDK what to do.. please do help.. for moving around or jumping, i am just using X and Y