Commit a94fec03 authored by christopher.spray's avatar christopher.spray

final

parent e095d4b0
import pygame
import math
import time
from random import randint
#Might need to change spawning area when implementing wall collision
......@@ -26,6 +27,8 @@ class Bandit(pygame.sprite.Sprite):
self.spriteGroupWall = spriteGroupWall
self.enemiesOnScreen = enemiesOnScreen
self.stopped = False
self.stoppedTime = 0
self.stopWaitLength = 0.01
if(self.spawnZone == 1):
#1 top = (300,0) - (500,50)
......@@ -60,11 +63,13 @@ class Bandit(pygame.sprite.Sprite):
xDiff = self.rect.x - otherBandit.rect.x
yDiff = self.rect.y - otherBandit.rect.y
totalDiff = math.hypot(xDiff, yDiff) #get Euclidian diff in coords
if totalDiff < self.rect.width and otherBandit.playerDist() < self.playerDist() and not self.stopped:
if totalDiff < self.rect.width and otherBandit.playerDist() < self.playerDist():
self.stopped = True
self.stoppedTimer = time.time()
print("STOPPED")
else:
self.stopped = False
if self.stopped and time.time() > self.stoppedTimer + self.stopWaitLength:
self.stopped = False
if not self.stopped:
try: #try this block
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment