def __init__(self, id): """ Arguments: o id - int """ self.level="M" Entity.__init__(self, id)
def __init__(self, x, y, image_path): Entity.__init__(self) self.image = pygame.image.load(image_path+"/plate.png") self.image = pygame.transform.scale(self.image, (32, 32)) self.image.convert() self.rect = Rect(x, y, 32, 32)
def __init__(self): Entity.__init__(self) self.type = 0 self.rage = False self.health = 1 self.dead = False self.facingRight = True
def __init__(self): Entity.__init__(self) self.lastfm = pylast.LastFMNetwork(api_key=params.LASTFM_API_KEY, api_secret=params.LASTFM_API_SECRET, username=USERNAME, password_hash=pylast.md5(PASSWORD)) config.ECHO_NEST_API_KEY = params.ECHONEST_API_KEY
def __init__(self, x, y, image_path): Entity.__init__(self) self.image = pygame.image.load(image_path+"/ground.png") self.image = pygame.transform.scale(self.image, (64*6, 64)) self.image.convert() self.rect = Rect(x, y, 64*6, 64)
def __init__(self, x, y): Entity.__init__(self) self.image = pygame.image.load("files/Platforms/Bad_Platform.png") self.image = pygame.transform.scale(self.image, (128, 32)) self.image.convert() self.rect = Rect(x, y+10, 128, 32) #Платформата се извежда "вкопана"
def __init__(self, id, name, numberOfUnits=1, parentBatch=None, parentBatchName=None, parentBatchId=None, remainingProcessingTime=0, currentStation=None, unitsToProcess=0,receiver=None,**kw): Entity.__init__(self, name=name, id=id, remainingProcessingTime=remainingProcessingTime, currentStation=currentStation) self.numberOfUnits=int(numberOfUnits) self.parentBatch=parentBatch self.unitsToProcess=int(float(unitsToProcess)) # if the parent batch was not given find it or create it if not self.parentBatch: # check if the parent batch is already created. If not, then create it batch=None from Batch import Batch from Globals import G for b in G.EntityList: if b.id==parentBatchId: batch=b if batch: #if the parent batch was found add the number of units of current sub-batch batch.numberOfUnits+=self.numberOfUnits else: #if the parent batch was not found create it batch=Batch(parentBatchId,parentBatchName,numberOfUnits) G.EntityList.append(batch) self.parentBatch=batch self.batchId=self.parentBatch.id import Globals self.receiver=Globals.findObjectById(receiver) self.parentBatch.subBatchList.append(self)
def __init__(self): Entity.__init__(self) UseableObject.__init__(self) self.pressSound = None self.pressIval = None self.assignToTrigger = False
def __init__(self, a): Entity.__init__(self, a) self.name = 'MouseEntity' self.mouse_pos = Vect2([0.0, 0.0]) self.origImage = pygame.image.load('data/mousePlayer.png') self.image = self.origImage self.imgState = 0 self.image1 = pygame.image.load('data/mousePlayer_1.png') self.image2 = pygame.image.load('data/mousePlayer_2.png') self.image3 = pygame.image.load('data/mousePlayer_3.png') self.grabsound = pygame.mixer.Sound('data/grab.wav') self.dropsound = pygame.mixer.Sound('data/drop.wav') self.image = self.origImage self.radius = self.image.get_rect().width/2 print self.radius self.rotate = 0 self.radius = float(self.image.get_width()) / 2.0 self.maxSpeed = 100 self.grabbing = False self.grabDist = 60 # pixel distance within which you can grab something self.grabbedEntity = None
def __init__(self): Entity.__init__(self) self.setLightOff(1) #self.setShaderOff(1) self.setMaterialOff(1) self.lightGlow = None
def __init__(self, x, y, imageName=None, colorkey=None, coordsName=None, numImages=None, magicNumbers=(0, 0, 0, 0, 0, 0, 0, 0), director=None, *args): Entity.__init__(self, x, y, imageName, colorkey, coordsName, numImages) self.director = None self.speedX = 0 self.speedY = 0 self.controller = None self.equippedWpn = None self.attacking = False self.atk_delay_reset = 1.0 # Character dependent delay time self.atk_delay = self.atk_delay_reset # Starts with cooldown. Trust me, it's better. self.hp = 40 self.atk = 10 # To what point is the character trying to attack? Useful for ranged # weapons. self.atkX = 0 self.atkY = 0 self.just_attacked = False if not imageName: self.rect = pygame.Rect(x, y, 15, 25) # Needed for a better weapon placement self.magicNumbers = magicNumbers self.atk_speed = PLAYER_ATTACK_SPEED
def __init__(self, id, name, numberOfUnits=1, currentStation=None, remainingProcessingTime=0, unitsToProcess=0, **kw): Entity.__init__(self, name=name, id=id, remainingProcessingTime=remainingProcessingTime, currentStation=currentStation) self.numberOfUnits=int(numberOfUnits) self.numberOfSubBatches=1 #integer that shows in how many sub batches is the batch broken self.subBatchList=[] #list that contains the sub-batches that this batch has been broken into self.unitsToProcess=int(float(unitsToProcess))
def __init__(self, id=None, name=None): Entity.__init__(self,id=id,name = name) self.Res=Resource(self.capacity) #dimension data self.width=2.0 self.height=2.0 self.lenght=2.0
def __init__(self, pos, radius, numVertices): Entity.__init__(self, radius, pos) if numVertices < 3: numVertices = 3 self.numVertices = numVertices self.verts = [(0,0)]*numVertices self.recalcVerts()
def __init__(self, pos): Entity.__init__(self, pos, 0.5, 2) self.stats = Stats() self.input = InputController(self) self.motion = MotionController(self) self.action = ActionController(self) self.color = 0xAA0077 self.net = -1
def __init__(self, x, y): Entity.__init__(self, x, y, "explosion.png", -1, "coordExplosion.txt", [25]) self.rect.centerx = x + 2 self.rect.bottom = y + 12 sound = load_sound("explosion.wav") sound.set_volume(0.25) sound.play()
def __init__(self): Entity.__init__(self) self.weapon = Pistol() self.playerCharacter = 0 self.onGround = True self.facingRight = True self.jumping= False self.jumpStart = 0 self.keysDown = []
def __init__(self, id=None, name=None, capacityProjectId=None, requiredCapacity=10, priority=0, dueDate=0, orderDate=0, currentStation=None, isCritical=False, **kw): Entity.__init__(self, id, name, priority, dueDate, orderDate, isCritical, currentStation=currentStation) self.capacityProjectId=capacityProjectId # the project id hat the capacity Entity is part of self.capacityProject=None # the project that the capacity Entity is part of. It is defined in initialize self.requiredCapacity=requiredCapacity # the capacity that the capacity entity requires from the following station self.shouldMove=False from Globals import G G.CapacityEntityList.append(self)
def __init__(self, params, pos): Entity.__init__(self) self.type = params[0] self.rage = False self.health = params[1] self.dead = False self.facingRight = True self.rect.size = params[2] self.rect.midtop = pos self.image = params[3]
def __init__(self, r_name, r_id, x_off, y_off, theta_off): self.current_load = 0 self.firstLaserReading = [] self.treesLeft = True self.disableSideLaser = False Entity.__init__(self, r_name, r_id,x_off,y_off, theta_off)
def __init__(self, id=None, name=None, capacityRequirementDict={}, earliestStartDict={}, dueDate=0, assemblySpaceRequirement=0, **kw): Entity.__init__(self, id, name, dueDate=dueDate) # a dict that shows the required capacity from every station self.capacityRequirementDict=capacityRequirementDict # a dict that shows the earliest start in every station self.earliestStartDict=earliestStartDict # the assembly space the project requires self.assemblySpaceRequirement=assemblySpaceRequirement from Globals import G G.CapacityProjectList.append(self)
def __init__(self, x, y, imageName=None, colorkey=None, coordsName=None, numImages=None, sound = None, soundVolume = 1, *args): Entity.__init__(self, x, y, imageName, colorkey, coordsName, numImages) self.active = False self.posIndex = POS_UP self.posImageIndex = 0 if sound: self.sound = load_sound(sound) self.sound.set_volume(soundVolume) else: self.sound = None
def __init__(self, x, y, skin): Entity.__init__(self) self.skin = skin self.image = pygame.image.load(self.skin+"/enemy_right.png") self.image = pygame.transform.scale(self.image, (55, 72)) self.image.convert() self.rect = Rect(x, y, 55, 72) #Платформата се извежда self.xvel = 1 self.yvel = 0 self.onGround = False self.hitPlatform = False
def __init__(self, pos, size): Entity.__init__(self) self.rect.size = size self.rect.center = pos self.damage = 0 self.effectTravel = None self.effectCollision = None self.playerInteract = False self.timer = 0 self.creationTime = 0 self.impactDestroy = True self.enemyImpactDestroy = True #Projectile is destroyed on contatct with enemies
def __init__(self, pos, theta): Entity.__init__(self, pos) self.theta = float(theta) self.color = (0,112,0) self.velocity = 5 self.angular_velocity = .524/6.0 # used to be 1.0 self.rotatingCW = False self.rotatingCCW = False self.moving = True self.sensor_dist = 150
def __init__(self, id, serial_num=None): """ Arguments: o id - int o serial_num - int """ self.level = "M" if serial_num is None: self.serial_num = id else: self.serial_num = serial_num Entity.__init__(self, id)
def __init__(self, id, serial_num = None): """ Arguments: o id - int o serial_num - int """ self.level="M" if serial_num is None: self.serial_num=id else: self.serial_num=serial_num Entity.__init__(self, id)
def __init__(self, whichType, position=None, flipped=False): Entity.__init__(self, whichType, position=position, flipped=flipped) #Collision #Controls self.isJumping = False self.isFlying = False self.flyCounter = 0 self.runState = None self.fireDelay = Player.FireDelay
def __init__(self, imageName=None, colorkey=None, clipRect=None, sound=None, soundVolume=1, *args): Entity.__init__(self, 0, 0, imageName, colorkey) if clipRect: self.rect = Rect(0, 0, clipRect.w, clipRect.h) self.sheetCoord = [[clipRect]] if sound: self.sound = load_sound(sound) self.sound.set_volume(soundVolume) else: self.sound = None self.melee = False
def __init__(self, id=None, name=None, route=[], priority=0, dueDate=0, orderDate=0, extraPropertyDict=None,currentStation=None, isCritical=False,**kw): Entity.__init__(self, id=id,name=name, priority=priority, dueDate=dueDate, currentStation=currentStation, orderDate=orderDate, isCritical=isCritical) # instance specific attributes # information on the routing and the stops of the entity self.route=route # the route that the job follows, # also contains the processing times in each station self.remainingRoute=list(route) # the remaining route. in the beginning # this should be the same as the full route self.extraPropertyDict = extraPropertyDict # variable used to differentiate entities with and entities without routes self.family='Job' # used by printRoute self.alias='J'+str(len(G.JobList))
def __init__(self): Entity.__init__(self, (0, 0), (0, 0), 25, True, GREEN) self.line = Line(self.posXY) self.health = 5 self.accXY = (0, 0) self.invincibility = 0 self.invincible = False self.colours = (RED, BLACK, self.colour) self.colourTimer = 0 self.maxVelocity = 15 self.legImage = ImageLoader.IMAGES['KNIGHT']['FRONT']['WALK'][0] self.bodyImage = ImageLoader.IMAGES['KNIGHT']['FRONT']['IDLE'] self.swordImage = ImageLoader.IMAGES['KNIGHT']['SWORD'] self.animationCounter = 0 self.animationFlags = [False, False] return
def __init__(self, image_paths,fps=10): Entity.__init__(self,image_paths,(200,230),fps,1) self.jumping = False # jumping flag self.can_jump = True self.health = 10 self._invincible = False # for when player collides with an enemy self._invincible_time = 0 # timer for invincibility self._speedDecay = [0.9, 1.0] self._invisible_pic = self.image.copy() self._invisible_pic.fill([0,0,0,0]) # scale images for player image_set = [] for image in self._images: image_set.append( ( pygame.transform.scale( image, (130,67) ) ) ) self._images = image_set self._rect = self._images[0].get_rect() self._rect.inflate_ip( -self._rect.width / 2, -self._rect.height / 2 )
def __init__(self, start_x, start_y, sprite_dir, width, height, frames, cache=None): Entity.__init__(self) # Directory where all the sprites will be held # This must include up, down, left, right in both idle and walking positions # TODO: Implement other movement types self.sprite_dir = sprite_dir # We can preload the cache in for duplicated characters or just create a new one if cache is None: self.cache = ImageCache(sprite_dir) else: self.cache = cache # Default the sprite to face down self.image = self.cache.get_image("down_1") # Where to spawn the character self.x_speed = 0 self.y_speed = 0 self.width = width self.height = height # Define movement properties self.speed = 8 self.sneak_mult = 0.4 self.sprint_mult = 1.5 # Animation properties self.anim_frames = frames # How many animation frames self.current_anim_frame = 0 self.frame_wait = 4 # How long to wait between frames self.current_frame_wait = 0 self.rect = Rect(start_x, start_y, self.width, self.height)
def __init__(self, r_name, r_id, x_off, y_off, theta_offset): Entity.__init__(self, r_name, r_id, x_off, y_off, theta_offset) self.dict_of_visitors = {} #Initialise subscriber to visitor self.sub_to_visitor = rospy.Subscriber("visitor_dog_topic", String, self.Visitor_Subscription) self.linearX = 3 self.animal_state = "" self._actions_ = { 0: self.move_forward, 1: self.goto_yx, 2: self.turn, 3: self.stop, 4: self.go_to_rand_location, 5: self.go_to_visitor }
def __init__(self, pos): Entity.__init__(self, "RSC/Player Images/playerstep1.png", [0,0], pos) self.upImages = [pygame.image.load("RSC/Player Images/playerbackstep1.png"), pygame.image.load("RSC/Player Images/playerbackstep2.png")] self.downImages = [pygame.image.load("RSC/Player Images/playerstep1.png"), pygame.image.load("RSC/Player Images/playerstep2.png")] self.leftImages = [pygame.image.load("RSC/Player Images/player1side.png"), pygame.image.load("RSC/Player Images/playerside1step.png")] self.rightImages = [pygame.image.load("RSC/Player Images/player2side.png"), pygame.image.load("RSC/Player Images/playerside2step.png")] self.facing = "up" self.changed = False self.images = self.upImages self.frame = 0 self.maxFrame = len(self.images) - 1 self.waitCount = 0 self.maxWait = 60*.25 self.image = self.images[self.frame] self.rect = self.image.get_rect(center = self.rect.center) self.maxSpeed = 4