hello there...
soooooo
im trying desperately since yesterday to implement a Star and its not working....
soooo I wished I could find help here maybe.
sooo what i have right now is:
plattform[1].connectionToPlattformExists[2] //contains an integer, tells if Plattform 1 and Plattform 2 are connected (1 for connected, 0 for not connected)
plattform[1].connectionToPlattformLength[2] //contains an float, with the cost from Plattform 1 to 2
i also have:
getPlayerPlattform() //gets the plattform on which the player stands
getHeuristic(1,2) //returns the air-distance from plattform 1 to plattform 2
now....
what i need is an function which tells me to which Plattform I need to go next.
like this:
getNextPlattform(getPlayerPlattform(),aimPlattform) //i dont have this
sooo for example if the plattforms are arranged like:
1 --- 2 ---- 3 ---- 4 ---- 5 ---- 6---- 7--- 8---- 9
and my Player stands on Plattform 6 , and the aimplattform is 9
this function should return 7
this is my code:
function getNextPlattform(startPlattform,aimPlattform)
NextPlattform as integer
bestElement as integer
current as integer
initializeList()
openFirstElement(startPlattform)
WHILE (getAnyOpenListExists() = 1)
current = findElementWithLeastFinOpenList()
if (current = aimPlattform)
NextPlattform = getNextPlattform2(aimPlattform)
exit
endif
popQoffTheOpenList(current )
makeTheCurrentParentOfConnectedPlattforms(current)
for i = 1 to plattformCount
if (list[i].parent = current ) //for each successor
if (aimPlattform = i)
else
if (list[i].closed = 0)
list[i].g = list[current].g + plattform[i].connectionToPlattformLength[current]
list[i].h = getHeuristic(i,aimPlattform)
list[i].f = list[i].g + list[i].h
list[i].open = 1
endif
endif
list[current].succ = findElementWithLeastFinOpenListWithParentX(current)
endif
next i
list[current].closed = 1
ENDWHILE
endfunction NextPlattform
well it keeps returning 0
and... well.... I dont know why and im debugging , but without a working debugger its hell ...
sigh..