Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///findNodeJump(currX,currY,dirX,dirY);
- if (argument2 != 0 && argument3 != 0) {
- currCost += 1.414;
- } else {
- currCost += 1;
- }
- show_debug_message("dirX: " + string(argument2) + "dirY: " + string(argument3));
- var nextX = argument0 + argument2;
- var nextY = argument1 + argument3;
- show_debug_message("Next Cell (" + string(nextX) + "," + string(nextY) + ")");
- //show_debug_message("Is Next Cell Passable?" + string(oAStar.passable[nextX,nextY]));
- if (!oAStar.passable[nextX,nextY]) {
- show_debug_message("Found Wall, Ending Current Jump");
- return 0;
- show_debug_message("return failed?!?!");
- }
- if (nextX == endCellX && nextY == endCellY) {
- return getKey(nextX,nextY)
- }
- //Diagonal Case
- if (argument2 != 0 && argument3 != 0) {
- if ((!oAStar.passable[nextX-argument2,nextY] && oAStar.passable[nextX,nextY+argument3]) || (!oAStar.passable[nextX,nextY-argument3] && oAStar.passable[nextX+argument2,nextY])) {
- //show_debug_message("Found Forced Neighbour Diagonal");
- return getKey(nextX,nextY);
- }
- if ((findNodeJump(nextX,nextY,argument2,0) || findNodeJump(nextX,nextY,0,argument3)) != 0) {
- show_debug_message("Forced Neighbour diag distant");
- return getKey(nextX,nextY);
- }
- } else {
- //Horizontal Case
- if (argument2 != 0) {
- //show_debug_message("Found Forced Neighbour Horizontal");
- if ((!oAStar.passable[nextX,nextY+1] && oAStar.passable[nextX+argument2,nextY+1]) || (!oAStar.passable[nextX,nextY-1] && oAStar.passable[nextX+argument2,nextY-1])) {
- return getKey(nextX,nextY);
- }
- //Vertical Case
- } else if (argument3 !=0){
- if ((!oAStar.passable[nextX+1,nextY] && oAStar.passable[nextX+1,nextY+argument3]) || (!oAStar.passable[nextX-1,nextY] && oAStar.passable[nextX-1,nextY+argument3])) {
- show_debug_message("Found Forced Neighbour Vertical");
- show_debug_message("Return value: " + string(getKey(nextX,nextY)));
- return getKey(nextX,nextY);
- }
- }
- //If forced neighbour was not found, try next jump point
- show_debug_message("No Forced Neighbour, continuing search");
- var jumpTo = findNodeJump(nextX,nextY,argument2,argument3);
- return jumpTo;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement