1

I was following this tutorial

http://blog.lukasjoswiak.com/gameplaykit-for-beginners-part-1/

and when I got to the end, I wanted to try to make the towers not completely impassable, but just have a higher cost.

so, I subclassed GKGridGraphNode and added a cost variable, overrode the costToNode function and tried to insert my cost variable into the equation.

I cannot seem to get it to work. The documentation on this is really doesn't explain having node cost beyond mentioning it in the subclassing notes. I was wondering if anyone has managed to do this?

I am probably going about it wrong, but even reading the Swift headers doesn't really give me any clues.

Thanks for the help

Update: Closed as duplicate

Weston
  • 1,481
  • 1
  • 11
  • 31
  • 2
    This may (or may not) help: http://stackoverflow.com/questions/31975084/costtonode-not-sent-to-gkgraphnode2d-subclass-in-gameplaykit – CodeSmile Oct 20 '15 at 19:09
  • yea, I saw that one too, but I doesn't appear to have ever been answered. – Weston Oct 21 '15 at 14:45

1 Answers1

1

I had a similar question, and I used one of my Apple developer support tickets to try to get an answer.

Apple responded and told me it was a known issue, and that there was a potential fix in the iOS SDK 9.2 beta 2, released November 3, 2015. I verified that the tests in my test project pass in 9.2b2, and so I expect that version to resolve this issue.

Community
  • 1
  • 1
Tim Arnold
  • 8,359
  • 8
  • 44
  • 67