private func transversePATH(from:Point,to:Point,stackUNDO:Bool=true ) {
var sequence : [SKAction] = []
//
// Transverse the designated Path
//
for i in(0...p!.count-1) {
//
// This section updates a counter for each move on the path
if i>0 {
let incMove = SKAction.customAction(withDuration: 0.01, actionBlock: { (node, elapsedTime) -> () in
print("Call #\(i)")
self.mySokobanDelegate?.updateMoveCount(moveCnt: 1)
})
sequence.append(incMove)
}
.... other unrelated stuff
}
theACTOR?.run(SKAction.sequence(sequence))
}
the line that says
print("Call #\(i)")
SHOULD be from 1 to 12 (for example) BUT some values are DUPLICATED?!
even more strange… the “sequence” (last line) has the correct # of calls
but I have to use delegate as the GUI is on another view
I could just call the delegate once with with the amount to update by, but I was hoping to show it counting as the sprite moved
Sorry, this a bit off topic… Seems like you are writing a Sokoban game. I have been thinking about rewriting my old Sokoban game as the 8th programming language now uses Nuklear based GUI and I could also support mobile platforms. It’s my version of the original game written for the Plan 9 and Inferno operating systems. I got permission to use data files from the original author. Do you have a level parser that allows using custom levels?
what I am writing is in Swift, and for macOS, iPhone, iPad and AppleTV. If by “parser” you mean an editor to create custom levels, then yes I have considered that. The problem is “real estate”, since the core device paredighm is the iPhone/iPad. (The macOS version is a by product of the iPad that runs on M1 devices), and navigation on the ATV would make an editor clumsy.
This is a sample screen shot (with a super simple puzzle)
My game can import a simple text file using commonly used Sokoban level format that is easy to parse. As an added bonus there are probably thousands of levels available online that can be used.