Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Sarven Gaps - trapped by fence?


Hey again,

I’m trying to build fences to trap some ogres in the Sarven Gaps level, and I keep trapping myself with the ogres. Help? Screen shot attached.


I think it’s because you’re moving to the enemy’s x-20 position, your hero is moving 20 meters away from the ogre, but the ogre is moving, so when you stop to build the fence, you end up on the wrong side.

What I’d suggest is remove the self.moveXY, and have a fixed move XY position in the else.


Thanks Devin!

So having a fixed move XY position doesn’t work because enemies keep appearing in other hallways, so the character isn’t responsive if you do a fixed move XY position. It turns out, the error was in moving the hero at all. I shouldn’t have defined the X and Y or spent the time moving to that spot because, as you pointed out, the ogres were moving toward me so by the time I moved and chose to build, that put me too far into the “canyon.” So, if anyone else has this issue, don’t do self.moveXY before building. Don’t move at all. Apparently you don’t even have to define the x and y ahead of time, just use:

if enemy:
self.buildXY(‘fence’, enemy.pos.x - 20, enemy.pos.y)
self.moveXY(self.pos.x, self.pos.y - 10)