Advertisement
Guest User

Key Delay Bugged

a guest
Jun 9th, 2014
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Create Event Variables
  2. Attack2 = false;
  3. Attack3 = false;
  4. can_attack = true;
  5. Key_Attack = false;
  6.  
  7. //Alarm0 1 and 2
  8. sprite_index = Stone_Middle;
  9. Attack2 = false;
  10. Attack3 = false;
  11.  
  12. //Alarm3
  13. can_attack = true;
  14. Key_Attack = false;
  15.  
  16. //Step Event
  17. //Regular Movement Variables
  18. Key_Left  = keyboard_check_direct (vk_left);
  19. Key_Right = keyboard_check_direct (vk_right);
  20. if can_attack and keyboard_check_pressed (ord('X'))
  21. {
  22.     Key_Attack = true;
  23.     can_attack = false;
  24.     alarm[3]= 10;  // your delay between key presses
  25. }
  26.  
  27. //Regular Movement
  28. if (Key_Left)
  29. {
  30.     image_xscale = -1;
  31.     x = obj_player.x + xOff_temp
  32. }
  33. else
  34. {
  35.     if (Key_Right)
  36.     {
  37.         image_xscale = 1;
  38.         x = obj_player.x - xOff_temp
  39.     }
  40. }
  41.  
  42. y = obj_player.y + yOff_temp
  43.  
  44. //Weapon sprites must have precise collision turned on to be effective
  45. if (Key_Attack) && (Attack2 = false) && (Attack3 = false)
  46. {
  47.     Attack2 = true;
  48.     sprite_index = player_djump;
  49.     if alarm[0]=-1 alarm = 50;
  50. }
  51.     else
  52.     {
  53.         if (Key_Attack) && (Attack2 = true)
  54.         {
  55.             Attack2 = false;
  56.             Attack3 = true;
  57.             image_index = 0;
  58.             sprite_index = player_idle;
  59.             image_speed = 0.125
  60.             if alarm[1]=-1 alarm = 50;
  61.         }
  62.     else
  63.     {
  64.         if (Key_Attack) && (Attack3 = true)
  65.         {
  66.         Attack3 = false;
  67.         image_index = 0;
  68.         sprite_index = player_slash;
  69.         image_speed = 0.125
  70.         if alarm[2]=-1 alarm = 100;
  71.         }
  72.     }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement