So i’m in the desert area, and i know that i could just use the self.moveXY method manually to dodge the yaks, but i want to use it the way i’m suppose to be using it, so here’s the thing:
My character can only detect enemy from all around him, but i want him to only focus on one of his side, kinda like:
loop:
x = self.pos.x
y = self.pos.y
enemy = self.findNearest(self.findEnemies())
if enemy and self.distanceTo(enemy) < (+x).10:
newX = self.pos.x-10
newY = self.pos.y
self.moveXY(newX, newY)
if enemy and self.distanceTo(enemy) < (-x).10:
newX = self.pos.x+10
newY = self.pos.y
self.moveXY(newX, newY)
the -x and +x is the side in which the character would react to the passing enemy (-x means left, +x means right), and adding the same +/- value to the y direction would result in the character’s FOV increase in an ark-like pattern.
But the point is, is there a string of code that would let me tell my character to focus on a particular side and tell him to scan the other direction if there’s no other enemy on said direction, because HOLY YAK the level is confusingly hard, i actually manage to finish the first level; simply by using the self.wait() method! And i have no idea what i’m suppose to be doing on the second level, so i’m officially stuck i guess
Also here’s my coding:
loop:
x = self.pos.x
y = self.pos.y
enemy = self.findNearest(self.findEnemies())
if enemy and self.distanceTo(enemy) < 15:
newX = self.pos.x+5
newY = self.pos.y
self.moveXY(newX, newY)
I don’t know what i’m suppose to do, i mess around with this coding for half an hour but my character is still want to pick up a fight with a yak that walk to his right by bumping to it. so do i have to manually set the self.moveXY method to avoid the rest of the Yak or what? Or should i experiment with the this “break” thing the veteran players keep adding to their own coding in the forum?
And thanks for reading beforehand