Advertisement
Guest User

Untitled

a guest
Oct 17th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. ///findNodeJump(currX,currY,dirX,dirY);
  2.  
  3. if (argument2 != 0 && argument3 != 0) {
  4. currCost += 1.414;
  5. } else {
  6. currCost += 1;
  7. }
  8. show_debug_message("dirX: " + string(argument2) + "dirY: " + string(argument3));
  9.  
  10. var nextX = argument0 + argument2;
  11. var nextY = argument1 + argument3;
  12.  
  13. show_debug_message("Next Cell (" + string(nextX) + "," + string(nextY) + ")");
  14. //show_debug_message("Is Next Cell Passable?" + string(oAStar.passable[nextX,nextY]));
  15.  
  16. if (!oAStar.passable[nextX,nextY]) {
  17. show_debug_message("Found Wall, Ending Current Jump");
  18. return 0;
  19. show_debug_message("return failed?!?!");
  20. }
  21.  
  22. if (nextX == endCellX && nextY == endCellY) {
  23. return getKey(nextX,nextY)
  24. }
  25.  
  26. //Diagonal Case
  27. if (argument2 != 0 && argument3 != 0) {
  28. if ((!oAStar.passable[nextX-argument2,nextY] && oAStar.passable[nextX,nextY+argument3]) || (!oAStar.passable[nextX,nextY-argument3] && oAStar.passable[nextX+argument2,nextY])) {
  29. //show_debug_message("Found Forced Neighbour Diagonal");
  30. return getKey(nextX,nextY);
  31. }
  32.  
  33. if ((findNodeJump(nextX,nextY,argument2,0) || findNodeJump(nextX,nextY,0,argument3)) != 0) {
  34. show_debug_message("Forced Neighbour diag distant");
  35. return getKey(nextX,nextY);
  36. }
  37. } else {
  38. //Horizontal Case
  39. if (argument2 != 0) {
  40. //show_debug_message("Found Forced Neighbour Horizontal");
  41. if ((!oAStar.passable[nextX,nextY+1] && oAStar.passable[nextX+argument2,nextY+1]) || (!oAStar.passable[nextX,nextY-1] && oAStar.passable[nextX+argument2,nextY-1])) {
  42. return getKey(nextX,nextY);
  43. }
  44. //Vertical Case
  45. } else if (argument3 !=0){
  46. if ((!oAStar.passable[nextX+1,nextY] && oAStar.passable[nextX+1,nextY+argument3]) || (!oAStar.passable[nextX-1,nextY] && oAStar.passable[nextX-1,nextY+argument3])) {
  47. show_debug_message("Found Forced Neighbour Vertical");
  48. show_debug_message("Return value: " + string(getKey(nextX,nextY)));
  49. return getKey(nextX,nextY);
  50. }
  51. }
  52. //If forced neighbour was not found, try next jump point
  53. show_debug_message("No Forced Neighbour, continuing search");
  54. var jumpTo = findNodeJump(nextX,nextY,argument2,argument3);
  55. return jumpTo;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement