def move(self, p):
if not self.dead:
plrPos = p.getPos()
plrX = plrPos[0]
plrY = plrPos[1]
self.collision(p)
DownRight = ['Down', 'Right']
UpRight = ['Right', 'Up']
UpLeft = ['Up', 'Left']
DownLeft = ['Down', 'Left']
AnyDirect = ['Down', 'Up', 'Left', 'Right']
if plrX > self.x and plrY > self.y:
self.x += .2
self.y += .2
if self.diff == 'noob':
num = random.randint(1, 200)
elif self.diff == 'easy':
num = random.randint(1, 100)
if num < 3:
self.direct = random.choice(DownRight)
elif plrX > self.x and plrY < self.y:
if self.diff == 'noob':
num = random.randint(1, 200)
elif self.diff == 'easy':
num = random.randint(1, 100)
if num < 3:
self.direct = random.choice(UpRight)
self.x += .2
self.y -= .2
elif plrX < self.x and plrY < self.y:
if self.diff == 'noob':
num = random.randint(1, 200)
elif self.diff == 'easy':
num = random.randint(1, 100)
if num < 3:
self.direct = random.choice(UpLeft)
self.x -= .2
self.y -= .2
elif plrX < self.x and plrY > self.y:
if self.diff == 'noob':
num = random.randint(1, 200)
elif self.diff == 'easy':
num = random.randint(1, 100)
if num < 3:
self.direct = random.choice(DownLeft)
self.x -= .2
self.y += .2
elif plrX == self.x and plrY > self.y:
if self.diff == 'noob':
num = random.randint(1, 200)
elif self.diff == 'easy':
num = random.randint(1, 100)
if num < 3:
self.direct = 'Down'
self.y += .2
elif plrX == self.x and plrY < self.y:
if self.diff == 'noob':
num = random.randint(1, 200)
elif self.diff == 'easy':
num = random.randint(1, 100)
if num < 3:
self.direct = 'Up'
self.y -= .2
elif plrY == self.y and plrX > self.x:
if self.diff == 'noob':
num = random.randint(1, 200)
elif self.diff == 'easy':
num = random.randint(1, 100)
if num < 3:
self.direct = 'Right'
self.x += .2
elif plrY == self.y and plrX < self.x:
if self.diff == 'noob':
num = random.randint(1, 200)
elif self.diff == 'easy':
num = random.randint(1, 100)
if num < 3:
self.direct = 'Left'
self.x -= .2
elif plrX == self.x and plrY == self.y:
if self.diff == 'noob':
num = random.randint(1, 200)
elif self.diff == 'easy':
num = random.randint(1, 100)
if num < 3:
self.direct = random.choice(AnyDirect)