When I went back to check why my error in my else was wrong I checked the help video and the way I did it works.
yak = self.findNearestEnemy
if yak.pos.y > self.pos.y
self.buildXY("fence", yak.pos.x, yak.pos.y - 10)
if yak.pos.y < self.pos.y
self.buildXY("fence", yak.pos.x, yak.pos.y + 10)
self.moveXY(self.pos.x, self.pos.y + 10)
I dont understand what you mean by "in this case the multiple indent was causing it to think the ‘if’ was completely over and done with, so ‘else:’ was an error since there was no ‘if’ attach to it."
I don’t understand what you mean because the else: is attached with the very first if and they were both same indentation, everything was lined up properly… ( I always perfect my indentions before making a forum post so I don’t waste peoples time.) Also, the other 2 if’s are lined up after the first if so basically IF there was a yak AND IF the yak’s Y position coordinates are greater then MY Y Coordinates, then self.buildXY(the yaks x position, the yaks y position - 10 units ) but IF the yak’s pos is less then my pos, self.buildXY(the yaks x pos, the yaks y pos + 10 units)
ELSE (NO YAK)
(That was just a more easier way to see it in my opinion to see why the else would work. Sorry if you don’t understand what I’m trying to say out of that) ( I also kinda don’t know what you mean because I removed the 2 pass’s (someone suggested to do that) and it worked just fine.) Basically the else would still be lined up with the very first if saying if there was a yak
if yak : build walls
(That’s my simple way of showing it)