Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. switch (parseInt($("#current-difficulty")[0].value)) {
  2. case 2:
  3. switch (currentPosition) {
  4. case 2:
  5. data= {direction:2, difficulty:1}; //2 dont move
  6. $("#current-position")[0].value = 2;
  7. break;
  8. case 1:
  9. data= {direction:1, difficulty:1}; // move 1 back
  10. $("#current-position")[0].value = 1;
  11. break;
  12. case 0:
  13. data= {direction:1, difficulty:2}; // move 2 back
  14. $("#current-position")[0].value = 2;
  15. break;
  16. }
  17. break;
  18. case 1:
  19. switch (currentPosition) {
  20. case 2:
  21. data= {direction: 0, difficulty: 1}; // move 1 forward
  22. $("#current-position")[0].value = 1;
  23. break;
  24. case 1:
  25. data= {direction: 2, difficulty: 0}; //go nowhere
  26. $("#current-position")[0].value = 1;
  27. break;
  28. case 0:
  29. data= {direction: 1, difficulty: 1}; // move 1 backward
  30. $("#current-position")[0].value = 0;
  31. break;
  32. }
  33. break;
  34. case 0:
  35. switch (currentPosition) {
  36. case 2:
  37.  
  38. console.log(currentPosition)
  39.  
  40. data= {direction: 0, difficulty: 2}; //move 2 forward
  41. $("#current-position")[0].value = 2;
  42. break;
  43. case 1:
  44. data= {direction: 0, difficulty: 1}; //move 1 forward
  45. $("#current-position")[0].value = 0;
  46. break;
  47. case 0:
  48. data= {direction: 2, difficulty: 0}; //go nowhere
  49. $("#current-position")[0].value = 0;
  50. break;
  51. }
  52. break;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement