def __init__(self, a, b, c, color=(128, 128, 128), reflects=False, material=None, ambientCoefficient=0.35, diffuseCoefficient=0.45, specularCoefficient=0.25): Entity.__init__(self, color, reflects, material, ambientCoefficient, diffuseCoefficient, specularCoefficient) self.a = a # point self.b = b # point self.c = c # point self.u = self.b - self.a # direction vector self.v = self.c - self.a # direction vector
def __init__(self,s,policier,a): Entity.__init__(self,s,a) self.ATTACK_RADIUS = (self.cfg.getData(1)) self.CONTAGION_AMOUNT = ast.literal_eval(self.cfg.getData(6)) self.contagionCount = ast.literal_eval(self.cfg.getData(6)) self.CONTAGION_RADIUS = ast.literal_eval(self.cfg.getData(12)) if (policier == True): self.setBulletAmount(self.cfg.getData(11))
def __init__(self, size, images, spawn): Entity.__init__(self, size, images[0]) self.size = size self.images = images self.old_time = pygame.time.get_ticks() self.health = 100 self.damage = 10 self.speed = 0.01 self.attack = False self.index = 0 self.rect = self.cpyimage.get_rect(center=spawn) self.pos = Vector2(spawn) self.diraction = Vector2(1, 0)
def allUsers(cls): url = User.urls['all'] response = httpRequest(url) response = json.load(response) users = [] for item in response: location = Location.locationById(item['location']) if item['location'] else None entity = Entity.entityById(item['entity']) if item['entity'] else None user = User(item['id'],item['userId'],item['userName'],item['name'],item['mobileNumber'], item['emailAddress'],item['emergencyContactNumber'],item['emergencyContactName'],item['emergencyContactEmail'], item['address'],location,entity) users.append(user) return users
def __init__(self): super().__init__() self.background = urwid.AttrMap(urwid.SolidFill(' '), 'bg') self.player = Player(Config.ARENA_WIDTH, Config.ARENA_HEIGHT) self.entities = [ Entity(Config.ARENA_WIDTH, Config.ARENA_HEIGHT) for _ in range(Config.ENEMIES) ] self.loop = urwid.MainLoop(self.__get_screen(), palette=Config.PALLETE, unhandled_input=self.handle_input)
def allVehicles(cls): url = Vehicle.urls['all'] response = httpRequest(url) response = json.load(response) vehicles = [] for item in response: entity = Entity.entityById( item['entity']) if item['entity'] else None device = Device.deviceById( item['device']) if item['device'] else None vehicle = Vehicle(item['id'], item['capacity'], device, entity, item['make'], item['model'], item['registrationNumber']) vehicles.append(vehicle) return vehicles
response = json.load(response) vehicle = Vehicle(response['id'], response['capacity'], device, entity, response['make'], response['model'], response['registrationNumber']) return vehicle @classmethod def allVehicles(cls): url = Vehicle.urls['all'] response = httpRequest(url) response = json.load(response) vehicles = [] for item in response: entity = Entity.entityById( item['entity']) if item['entity'] else None device = Device.deviceById( item['device']) if item['device'] else None vehicle = Vehicle(item['id'], item['capacity'], device, entity, item['make'], item['model'], item['registrationNumber']) vehicles.append(vehicle) return vehicles if __name__ == '__main__': entity = Entity.entityById(5) count = 90 for i in range(count): Vehicle.createVehicle(5, None, entity, 'Hyundai', 'I20', 'REG' + str(i))
def __init__(self, center, radius, color=None, reflects=False, material=None, ambientCoefficient=0.35, diffuseCoefficient=0.45, specularCoefficient=0.25): Entity.__init__(self, color, reflects, material, ambientCoefficient, diffuseCoefficient, specularCoefficient) self.center = center # point self.radius = radius #scalar
def __init__(self): self.player = Entity() self.player.x = 10 self.player.y = 10 self.entities.append(self.player)
def __init__(self,s,policier,a): Entity.__init__(self,s,a) if (policier == True): self.setBulletAmount(ast.literal_eval(self.cfg.getData(11)))
def __init__(self): self.devices = Device.allDevices() self.locations = Location.allLocations() self.users = User.allUsers() self.vehicles = Vehicle.allVehicles() self.entities = Entity.allEntities()
def __init__(self,s,a): Entity.__init__(self,s,a) self.berzerkDelay = ast.literal_eval(self.cfg.getData(7)) self.BERZERK_RADIUS = ast.literal_eval(self.cfg.getData(2))