Advertisement
Guest User

Untitled

a guest
Aug 29th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. #pragma strict
  2.  
  3. public var one_press : boolean;
  4. //public var timer_running : boolean;
  5. public var delay : float;
  6. public var two_press : boolean;
  7. public var can_dodge : boolean;
  8. public var two_press_timer : float;
  9. public var dodge_direction : Vector3;
  10. public var Player : Transform;
  11.  
  12. function Update(){
  13.  
  14. Debug.DrawRay(Player.position, -Player.right, Color.red, 1);
  15. if(Input.GetKeyDown(KeyCode.A)) {
  16.  
  17. if(!one_press)
  18. {
  19. one_press = true;
  20. delay = Time.time + .2;
  21. }
  22. else
  23. {
  24. one_press = false;
  25. two_press_timer = 0.3;
  26. two_press = true;
  27. }
  28.  
  29. }
  30.  
  31. if (Physics.Raycast(Player.position, -Player.right, 1))
  32. {two_press = false;
  33. }
  34.  
  35. if(one_press)
  36. {
  37. if((Time.time - .2) > delay)
  38. {
  39. one_press = false;
  40.  
  41. }
  42. }
  43. if (two_press)
  44. {
  45. two_press_timer = two_press_timer - Time.deltaTime;
  46. transform.Translate(Vector3.left * 20 * Time.deltaTime);
  47. if (two_press_timer < 0)
  48. {
  49. two_press = false;
  50. }
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement