Bug with Stranded in the Dunes

It was hilarious to suddenly see a horde of them rush in, but I’m veeery certain this isn’t supposed to happen:

Edit: I found out something in my code causes it to happen:

``````	loop
local enemies = self:findEnemies()
for en=1, #enemies do
local enemy = enemies[en];
if enemy.type ~= "sand-yak" and enemy.type ~= "raven" and enemy.health > 0 then
local distance = self:distanceTo(enemy)

end
end
self:move({x=self.pos.x+math.random(0,2)-1,y=self.pos.y+math.random(0,2)-1})
end
``````

Edit 2:

to be exact, this is what triggers it:

``````	self:move({x=self.pos.x+math.random(0,2)-1,y=self.pos.y+math.random(0,2)-1})
self:move({x=self.pos.x+math.random(0,2)-1,y=self.pos.y+math.random(0,2)-1})
``````

as soon as it’s called a second time, the sand-yak’s rush in. XD

Edit 3:

JavaScript has the same thing, however needs it to be called more than 2 times, but triggers nonetheless.

``````	function rand(min, max) {
return Math.random() * (max - min) + min;
}

loop {
this.move({x: this.pos.x+rand(0,2)-1 , y: this.pos.y+rand(0,2)-1 });
}
``````

I couldn’t get a random function working in python, haven’t used it as much yet. But I assume if it’s in 2 languages, it’s all of them.

I don’t think it has anything to do with the code itself. I solved it in python, I didn’t use the `random` function at all, but the yaks still popped up on each screen. I guess it’s just randomly added to make your life a bit more difficult…

I know it’s solveable, but I don’t think the yaks are supposed to appear in the first part of the map. It’s somehow triggered on movement however. I also found out that if you go all the way to the north of the first map, and go right to the next one, the skeletons don’t see you and get killed by the yaks . Not so much a bug as a usefull stealth addition, which I think is a good thing.

The yaks are running in when you go near the other sand yak so just don’t move near the yak.

1 Like