Hoping someone can help me out here; trying to complete “Stranded in the Dunes” in Python and, whilst I don’t believe it’s a bug per se, I’m really not sure how to complete it without using flags.
The problem being that when I use self.pos.x+1 to move the character right, that’s all well and fine up until it hits the right border and the scene changes, but that currentPos = self.pos isn’t updating, because the last x point is held over from the previous screen.
This can be demonstrated in a particularly horrible and simple loop I used to narrow down the issue here:
Get rid of the variable currentPos and just use self.pos. That way, the hero will be constantly updating its position and you shouldn’t have this problem.
I did actually manage to find “something” of a workaround, although not particularly elegant, which was this:
loop:
enemy = self.findNearestEnemy()
if enemy:
self.attack(enemy)
else:
currentPos = self.pos
self.say(currentPos)
if currentPos.x > 117:
self.moveXY(currentPos.x +0.4,currentPos.y)
self.say("Hmm!") # Seems you need a pause here for the screen right transition kick in.
self.moveXY(1,currentPos.y)
else:
self.moveXY(currentPos.x + 1, currentPos.y)
Which I’m not going to lie, is horrible, but going to expand on it a bit and see if it holds true to other screens as it progresses right.