def draw(self, surf): if self.show and self.fade < 100: self.fade += self.transition_speed for sprite in self.sprites: sprite.image = Image_Modification.flickerImageTranslucentColorKey(sprite.true_image, 100 - self.fade) elif not self.show and self.fade > 0: self.fade -= self.transition_speed for sprite in self.sprites: sprite.image = Image_Modification.flickerImageTranslucentColorKey(sprite.true_image, 100 - self.fade) # Now actually draw for sprite in self.sprites: sprite.draw(surf)
def draw(self, surf, position): pos = (position[0] * GC.TILEWIDTH, position[1] * GC.TILEHEIGHT) surf.blit(self.image, pos) if self.new_image: self.fade += self.transition_speed new_image = Image_Modification.flickerImageTranslucentColorKey(self.new_image, 100 - self.fade) surf.blit(new_image, pos) if self.fade >= 100: # Done self.image_name = self.new_image_name self.position = self.new_position self.loadSprites() self.reset_transition()
def draw(self, surf, gameStateObj): """Assumes image has already been developed.""" image = self.create_image(self.image_state) x, y = self.unit.position left = x * GC.TILEWIDTH + self.spriteOffset[0] top = y * GC.TILEHEIGHT + self.spriteOffset[1] # Active Skill Icon if not self.unit.isDying and 'ActiveSkillCharged' in self.unit.tags: active_icon = GC.ICONDICT["ActiveSkill"] active_icon = Engine.subsurface( active_icon, (GC.PASSIVESPRITECOUNTER.count * 32, 0, 32, 32)) topleft = (left - max(0, (active_icon.get_width() - 16) // 2), top - max(0, (active_icon.get_height() - 16) // 2)) surf.blit(active_icon, topleft) if self.transition_state in WARP_OUT_SET: if self.unit.deathCounter: image = Image_Modification.flickerImageWhiteColorKey( image, 255) image = Image_Modification.flickerImageTranslucentColorKey( image, int(100 * self.unit.deathCounter // 27)) else: self.transition_counter -= Engine.get_delta() if self.transition_counter < 0: self.transition_counter = 0 image = Image_Modification.flickerImageTranslucentColorKey( image, 100 - self.transition_counter // (self.transition_time // 100)) if self.transition_counter <= 0: if self.transition_state == 'fade_out': self.transition_state = 'normal' if self.state == 'fake_transition_out': self.change_state('normal', gameStateObj) self.unit.die(gameStateObj) elif self.transition_state == 'fade_out_event': self.transition_state = 'normal' if self.state == 'fake_transition_out': self.change_state('normal', gameStateObj) self.unit.die(gameStateObj, event=True) elif self.transition_state == 'warp_out': gameStateObj.map.initiate_warp_flowers( self.unit.position) self.unit.die(gameStateObj, event=True) self.transition_state = 'normal' if self.state == 'fake_transition_out': self.change_state('normal', gameStateObj) elif self.transition_state in ('fade_move', 'warp_move'): # gameStateObj.map.initiate_warp_flowers(self.unit.position) self.unit.leave(gameStateObj) self.unit.position = self.next_position self.unit.previous_position = self.next_position self.unit.arrive(gameStateObj) gameStateObj.cursor.setPosition( self.unit.position, gameStateObj) # gameStateObj.stateMachine.changeState('move_camera') self.next_position = None gameStateObj.map.initiate_warp_flowers( self.unit.position) if self.transition_state == 'fade_move': self.set_transition('fade_in') elif self.transition_state == 'warp_move': self.set_transition('warp_in') elif self.transition_state == 'warp_in' or self.transition_state == 'fade_in': self.transition_counter -= Engine.get_delta() if self.transition_counter < 0: self.transition_counter = 0 image = Image_Modification.flickerImageTranslucentColorKey( image, self.transition_counter // (self.transition_time // 100)) if self.transition_counter <= 0: self.transition_state = 'normal' if self.state == 'fake_transition_in': self.change_state('normal', gameStateObj) if self.unit.flicker: color = self.unit.flicker[2] total_time = self.unit.flicker[1] starting_time = self.unit.flicker[0] time_passed = Engine.get_time() - starting_time if time_passed >= total_time: self.unit.end_flicker() else: color = ((total_time - time_passed) * float(c) // total_time for c in color) # image = Image_Modification.flicker_image(image.convert_alpha(), color) image = Image_Modification.change_image_color( image.convert_alpha(), color) elif self.unit.flickerRed and gameStateObj.boundary_manager.draw_flag: image = Image_Modification.flickerImageRed(image.convert_alpha(), 80) # if any(status.unit_translucent for status in self.unit.status_effects): if 'unit_translucent' in self.unit.status_bundle: image = Image_Modification.flickerImageTranslucentColorKey( image, 50) if 'unit_tint' in self.unit.status_bundle: for status in self.unit.status_effects: if status.unit_tint: color = status.unit_tint.color time = Engine.get_time() diff = Utility.determine_perc(time, status.unit_tint.period, status.unit_tint.width) diff = Utility.clamp( 255. * diff * status.unit_tint.max_alpha, 0, 255) color = (color[0], color[1], color[2], diff) image = Image_Modification.color_tint( image.convert_alpha(), color) # Active Skill Indicator -- this flashes the unit yellow when a skill is charged # if not self.unit.isDying and 'ActiveSkillCharged' in self.unit.tags: # time = Engine.get_time() # length = 500 # if not (time//1000)%3 and not (time//length)%(1000//length): # diff = time%length # if diff > length//2: # diff = length - diff # diff = Utility.clamp(255. * diff / length * 2, 0, 255) # color = (248, 248, -248, diff) # image = Image_Modification.color_tint(image.convert_alpha(), color) # What is this line even doing? - Something majorly important though # Each image has (self.image.get_width() - 32)/2 buffers on the left and right of it, to handle any off tile spriting # Without self.image.get_width() - 32)//2, we would output the left buffer along with the unit, # and the unit would end up +left buffer width to the right of where it should be topleft = left - max(0, (image.get_width() - 16) // 2), top - 24 surf.blit(image, topleft) # ======= # Status Aura Icon if not self.unit.isDying and 'aura' in self.unit.status_bundle: aura_icon_name = self.unit.team + 'AuraIcon' aura_icon = GC.IMAGESDICT[ aura_icon_name] if aura_icon_name in GC.IMAGESDICT else GC.IMAGESDICT[ 'AuraIcon'] aura_icon = Engine.subsurface( aura_icon, (0, GC.PASSIVESPRITECOUNTER.count * 10, 32, 10)) topleft = (left - max(0, (aura_icon.get_width() - 16) // 2), top - max(0, (aura_icon.get_height() - 16) // 2) + 8) surf.blit(aura_icon, topleft) # Status always animationss for status in self.unit.status_effects: if status.always_animation: x, y = self.unit.position topleft = (x - 1) * GC.TILEWIDTH + self.spriteOffset[0], ( y - 1) * GC.TILEHEIGHT + self.spriteOffset[1] surf.blit(status.always_animation.image, topleft) if self.transition_state.startswith('warp'): num_frames = 12 fps = self.transition_time // num_frames frame = (self.transition_time - self.transition_counter) // fps if frame >= 0 and frame < num_frames: warp_anim = Engine.subsurface(GC.IMAGESDICT['Warp'], (frame * 32, 0, 32, 48)) topleft = (left - max(0, (warp_anim.get_width() - 16) // 2), top - max(0, (warp_anim.get_height() - 16) // 2) - 4) surf.blit(warp_anim, topleft) # Talk, Warning and Danger icons if gameStateObj.cursor.currentSelectedUnit: cur_unit = gameStateObj.cursor.currentSelectedUnit if (cur_unit, self.unit.name) in gameStateObj.talk_options: frame = (Engine.get_time() // 100) % 8 topleft = (left - 1, top - 12) if frame in (0, 1, 2): offset = 0 elif frame in (3, 7): offset = 1 else: offset = 2 surf.blit(GC.IMAGESDICT['TalkMarker'], (topleft[0], topleft[1] + offset)) if self.unit.checkIfEnemy(cur_unit): self.draw_warning_marker(surf, left, top, cur_unit)
def draw(self, surf, talk=False): current_time = pygame.time.get_ticks() """Assumes image has already been developed.""" image = self.create_image(self.state) x, y = self.unit.position left = x * TILEWIDTH + self.spriteOffset[0] top = y * TILEHEIGHT + self.spriteOffset[1] # Active Skill Icon if not self.unit.isDying and any(status.active and status.active.required_charge and status.active.current_charge >= status.active.required_charge for status in self.unit.status_effects): active_icon = ICONDICT["ActiveSkill"] active_icon = active_icon.subsurface(pygame.Rect(SPRITECOUNTER.count*32, 0, 32, 32)) iconRect = active_icon.get_rect() iconRect.topleft = (left - max(0, (active_icon.get_width() - 16)/2), top - max(0, (active_icon.get_height() - 16)/2)) surf.blit(active_icon, iconRect) if self.unit.isDying: image = Image_Modification.flickerImageTranslucentColorKey(image, self.unit.deathCounter/2) elif self.unit.flickerWhite: total_time = self.unit.flickerWhite[1] starting_time = self.unit.flickerWhite[0] time_passed = current_time - starting_time if time_passed >= total_time: self.unit.end_flicker_white() else: whiteness = (total_time/2 - abs(time_passed - total_time/2))*255.0/(total_time/2) #image = Image_Modification.flickerImageWhiteColorKey(image, whiteness) image = Image_Modification.flickerImageWhite(image.convert_alpha(), whiteness) elif any(status.unit_translucent for status in self.unit.status_effects): image = Image_Modification.flickerImageTranslucentColorKey(image, 50) # What is this line even doing? - Something majorly important though # Each image has (self.image.get_width() - 32)/2 buffers on the left and right of it, to handle any off tile spriting # Without self.image.get_width() - 32)/2, we would output the left buffer along with the unit, and the unit would end up +left buffer width to the right of where he should be spaceRect = pygame.Rect(left - max(0, (image.get_width() - 16)/2), top - max(0, image.get_height() - 16), TILEWIDTH, TILEHEIGHT) surf.blit(image, spaceRect) # Health Bar if self.state in ['gray', 'passive'] and not self.unit.isDying: if (OPTIONS['HP Map Team'] == 'All') or (OPTIONS['HP Map Team'] == 'Ally' and self.unit.team in ['player', 'other']) or (OPTIONS['HP Map Team'] == 'Enemy' and self.unit.team.startswith('enemy')): if(OPTIONS['HP Map Cull'] == 'All') or (OPTIONS['HP Map Cull'] == 'Wounded' and self.unit.currenthp < self.unit.stats['HP']): health_outline = IMAGESDICT['Map_Health_Outline'] health_bar = IMAGESDICT['Map_Health_Bar'] if(self.unit.currenthp == int(self.unit.stats['HP'])): cut_off = 13 else: cut_off = int((self.unit.currenthp/float(self.unit.stats['HP']))*12) surf.blit(health_outline, (left, top+13)) health_bar = health_bar.subsurface((0, 0, cut_off, 1)) surf.blit(health_bar, (left+1, top+14)) # Extra Icons if 'Boss' in self.unit.tags and self.state in ['gray', 'passive'] and int((current_time%4000)/400) in [0, 2, 4, 6, 8]: # Essentially an every 400 millisecond timer bossIcon = ICONDICT['BossIcon'] surf.blit(bossIcon, (left, top)) if self.unit.TRV: if self.unit.TRV.team == 'player': rescueIcon = ICONDICT['BlueRescueIcon'] else: # self.TRV.team == 'other': rescueIcon = ICONDICT['GreenRescueIcon'] iconRect = rescueIcon.get_rect() iconRect.topleft = (left - max(0, (rescueIcon.get_width() - 16)/2), top - max(0, (rescueIcon.get_height() - 16)/2)) surf.blit(rescueIcon, iconRect) # ======= # Status Aura Icon if not self.unit.isDying and any(status.aura for status in self.unit.status_effects): aura_icon_name = self.unit.team + 'AuraIcon' aura_icon = IMAGESDICT[aura_icon_name] if aura_icon_name in IMAGESDICT else IMAGESDICT['AuraIcon'] aura_icon = aura_icon.subsurface(pygame.Rect(0, SPRITECOUNTER.count*10, 32, 10)) topleft = (left - max(0, (aura_icon.get_width() - 16)/2), top - max(0, (aura_icon.get_height() - 16)/2) + 8) surf.blit(aura_icon, topleft) # Status always animationss for status in self.unit.status_effects: if status.always_animation: x,y = self.unit.position spaceRect = pygame.Rect((x-1) * TILEWIDTH + self.spriteOffset[0], (y-1) * TILEHEIGHT + self.spriteOffset[1], status.always_animation.image.get_width(), status.always_animation.image.get_height()) surf.blit(status.always_animation.image, spaceRect) if self.unit.useWarp: num_frames = 12 fps = 200/num_frames # Warp out if self.unit.isDying: frame = (self.unit.deathCounter-20)/fps else: # Warp in frame = ((current_time - self.unit.useWarp)/fps) if frame >= 0 and frame < num_frames: warp_anim = IMAGESDICT['Warp'].subsurface(pygame.Rect(frame*32, 0, 32, 48)) topleft = (left - max(0, (warp_anim.get_width() - 16)/2), top - max(0, (warp_anim.get_height() - 16)/2) - 4) surf.blit(warp_anim, topleft) elif frame >= num_frames: self.unit.useWarp = False if talk: frame = (current_time/100)%8 topleft = (left + 6, top - 12) surf.blit(IMAGESDICT['TalkMarker'].subsurface(pygame.Rect(frame*8, 0, 8, 16)), topleft)
def draw(self, surf, gameStateObj): """Assumes image has already been developed.""" image = self.create_image(self.image_state) x, y = self.unit.position left = x * GC.TILEWIDTH + self.spriteOffset[0] top = y * GC.TILEHEIGHT + self.spriteOffset[1] # Active Skill Icon if not self.unit.isDying: for status in self.unit.status_effects: if (status.combat_art and status.combat_art.check_charged() and status.combat_art.get_max() > 0 and status.combat_art.is_activated()) \ or (status.activated_item and status.activated_item.check_charged() and status.activated_item.get_max() > 0): active_icon = GC.ICONDICT["ActiveSkill"] active_icon = Engine.subsurface(active_icon, (GC.PASSIVESPRITECOUNTER.count*32, 0, 32, 32)) topleft = (left - max(0, (active_icon.get_width() - 16)//2), top - max(0, (active_icon.get_height() - 16)//2)) surf.blit(active_icon, topleft) break if self.transition_state in WARP_OUT_SET: if self.unit.deathCounter: image = Image_Modification.flickerImageWhiteColorKey(image, 255) image = Image_Modification.flickerImageTranslucentColorKey(image, int(100*self.unit.deathCounter//27)) else: image = Image_Modification.flickerImageTranslucentColorKey(image, 100 - self.transition_counter//(self.transition_time//100)) elif self.transition_state == 'warp_in' or self.transition_state == 'fade_in': image = Image_Modification.flickerImageTranslucentColorKey(image, self.transition_counter//(self.transition_time//100)) if self.unit.flicker: color = self.unit.flicker[2] total_time = self.unit.flicker[1] starting_time = self.unit.flicker[0] time_passed = Engine.get_time() - starting_time if time_passed >= total_time: self.unit.end_flicker() else: color = ((total_time - time_passed)*float(c)//total_time for c in color) # image = Image_Modification.flicker_image(image.convert_alpha(), color) image = Image_Modification.change_image_color(image.convert_alpha(), color) elif self.unit.flickerRed and gameStateObj.boundary_manager.draw_flag: image = Image_Modification.flickerImageRed(image.convert_alpha(), 80) # if any(status.unit_translucent for status in self.unit.status_effects): if 'unit_translucent' in self.unit.status_bundle: image = Image_Modification.flickerImageTranslucentColorKey(image, 50) if 'unit_tint' in self.unit.status_bundle: for status in self.unit.status_effects: if status.unit_tint: color = status.unit_tint.color time = Engine.get_time() diff = Utility.determine_perc(time, status.unit_tint.period, status.unit_tint.width) diff = Utility.clamp(255. * diff * status.unit_tint.max_alpha, 0, 255) color = (color[0], color[1], color[2], diff) image = Image_Modification.color_tint(image.convert_alpha(), color) # Active Skill Indicator -- this flashes the unit yellow when a skill is charged # if not self.unit.isDying and 'ActiveSkillCharged' in self.unit.tags: # time = Engine.get_time() # length = 500 # if not (time//1000)%3 and not (time//length)%(1000//length): # diff = time%length # if diff > length//2: # diff = length - diff # diff = Utility.clamp(255. * diff / length * 2, 0, 255) # color = (248, 248, -248, diff) # image = Image_Modification.color_tint(image.convert_alpha(), color) # Turnwheel indicator -- this flashes the unit green if self.turnwheel_indicator: time = Engine.get_time() length = 200 if not (time//200)%2 and not (time//length)%(200//length): diff = time%length if diff > length//2: diff = length - diff diff = Utility.clamp(255. * diff / length * 2, 0, 255) color = (-120, 120, -120, diff) image = Image_Modification.color_tint(image.convert_alpha(), color) # What is this line even doing? - Something majorly important though # Each image has (self.image.get_width() - 32)/2 buffers on the left and right of it, to handle any off tile spriting # Without self.image.get_width() - 32)//2, we would output the left buffer along with the unit, # and the unit would end up +left buffer width to the right of where it should be topleft = left - max(0, (image.get_width() - 16)//2), top - 24 surf.blit(image, topleft) # ======= # Status Aura Icon if not self.unit.isDying and 'aura' in self.unit.status_bundle: aura_icon_name = self.unit.team + 'AuraIcon' aura_icon = GC.IMAGESDICT[aura_icon_name] if aura_icon_name in GC.IMAGESDICT else GC.IMAGESDICT['AuraIcon'] aura_icon = Engine.subsurface(aura_icon, (0, GC.PASSIVESPRITECOUNTER.count*10, 32, 10)) topleft = (left - max(0, (aura_icon.get_width() - 16)//2), top - max(0, (aura_icon.get_height() - 16)//2) + 8) surf.blit(aura_icon, topleft) # Status always animationss for status in self.unit.status_effects: if status.always_animation: x, y = self.unit.position topleft = (x-1) * GC.TILEWIDTH + self.spriteOffset[0], (y-1) * GC.TILEHEIGHT + self.spriteOffset[1] surf.blit(status.always_animation.image, topleft) if self.transition_state.startswith('warp'): num_frames = 12 fps = self.transition_time//num_frames frame = (self.transition_time - self.transition_counter)//fps if frame >= 0 and frame < num_frames: warp_anim = Engine.subsurface(GC.IMAGESDICT['Warp'], (frame*32, 0, 32, 48)) topleft = (left - max(0, (warp_anim.get_width() - 16)//2), top - max(0, (warp_anim.get_height() - 16)//2) - 4) surf.blit(warp_anim, topleft) # Talk, Warning and Danger icons if gameStateObj.cursor.currentSelectedUnit: cur_unit = gameStateObj.cursor.currentSelectedUnit if (cur_unit.id, self.unit.id) in gameStateObj.talk_options: frame = (Engine.get_time()//100)%8 topleft = (left - 1, top - 12) if frame in (0, 1, 2): offset = 0 elif frame in (3, 7): offset = 1 else: offset = 2 surf.blit(GC.IMAGESDICT['TalkMarker'], (topleft[0], topleft[1] + offset)) elif self.unit.checkIfEnemy(cur_unit) and cur_unit.team == 'player': self.draw_warning_marker(surf, left, top, cur_unit) elif gameStateObj.support and gameStateObj.support.get_edge(cur_unit.id, self.unit.id): level = gameStateObj.support.get_edge(cur_unit.id, self.unit.id).get_support_level() if level > 0: level = min(level, 3) icon = Engine.subsurface(GC.IMAGESDICT['MapSupportIcons65'], ((level-1)*8, 0, 8, 11)) frame = (Engine.get_time()//100)%8 topleft = (left + 4, top - 11) if frame in (0, 1, 2): offset = 0 elif frame in (3, 7): offset = 1 else: offset = 2 # diff = Utility.determine_perc(Engine.get_time(), 2000, 2000) # print(diff) # diff = Utility.clamp(255. * diff, 0, 255) # tint = (0, -64, 128, diff) # icon = Image_Modification.color_tint(icon.copy(), tint) surf.blit(icon, (topleft[0], topleft[1] + offset))
def draw(self, surf, gameStateObj): """Assumes image has already been developed.""" image = self.create_image(self.image_state) x, y = self.unit.position left = x * GC.TILEWIDTH + self.spriteOffset[0] top = y * GC.TILEHEIGHT + self.spriteOffset[1] # Active Skill Icon if not self.unit.isDying and 'ActiveSkillCharged' in self.unit.tags: active_icon = GC.ICONDICT["ActiveSkill"] active_icon = Engine.subsurface( active_icon, (GC.PASSIVESPRITECOUNTER.count * 32, 0, 32, 32)) topleft = (left - max(0, (active_icon.get_width() - 16) / 2), top - max(0, (active_icon.get_height() - 16) / 2)) surf.blit(active_icon, topleft) if self.transition_state in WARP_OUT_SET: if self.unit.deathCounter: image = Image_Modification.flickerImageWhiteColorKey( image, 255) image = Image_Modification.flickerImageTranslucentColorKey( image, int(100 * self.unit.deathCounter / 27)) else: self.transition_counter -= Engine.get_delta() if self.transition_counter < 0: self.transition_counter = 0 image = Image_Modification.flickerImageTranslucentColorKey( image, 100 - self.transition_counter / (self.transition_time / 100)) if self.transition_counter <= 0: if self.transition_state == 'fade_out': self.transition_state = 'normal' if self.state == 'fake_transition_out': self.change_state('normal', gameStateObj) self.unit.die(gameStateObj, event=True) elif self.transition_state == 'warp_out': gameStateObj.map.initiate_warp_flowers( self.unit.position) self.unit.die(gameStateObj, event=True) self.transition_state = 'normal' if self.state == 'fake_transition_out': self.change_state('normal', gameStateObj) elif self.transition_state in ('fade_move', 'warp_move'): gameStateObj.map.initiate_warp_flowers( self.unit.position) self.unit.leave(gameStateObj) self.unit.position = self.next_position self.unit.arrive(gameStateObj) self.next_position = None gameStateObj.map.initiate_warp_flowers( self.unit.position) if self.transition_state == 'fade_move': self.set_transition('fade_in') elif self.transition_state == 'warp_move': self.set_transition('warp_in') elif self.transition_state == 'warp_in' or self.transition_state == 'fade_in': self.transition_counter -= Engine.get_delta() if self.transition_counter < 0: self.transition_counter = 0 image = Image_Modification.flickerImageTranslucentColorKey( image, self.transition_counter / (self.transition_time / 100)) if self.transition_counter <= 0: self.transition_state = 'normal' if self.state == 'fake_transition_in': self.change_state('normal', gameStateObj) elif self.unit.flicker: color = self.unit.flicker[2] total_time = self.unit.flicker[1] starting_time = self.unit.flicker[0] time_passed = Engine.get_time() - starting_time if time_passed >= total_time: self.unit.end_flicker() else: color = ((total_time - time_passed) * float(c) / total_time for c in color) # image = Image_Modification.flicker_image(image.convert_alpha(), color) image = Image_Modification.change_image_color( image.convert_alpha(), color) elif self.unit.flickerRed and gameStateObj.boundary_manager.draw_flag: image = Image_Modification.flickerImageRed(image.convert_alpha(), 80) # if any(status.unit_translucent for status in self.unit.status_effects): if 'unit_translucent' in self.unit.status_bundle: image = Image_Modification.flickerImageTranslucentColorKey( image, 50) # What is this line even doing? - Something majorly important though # Each image has (self.image.get_width() - 32)/2 buffers on the left and right of it, to handle any off tile spriting # Without self.image.get_width() - 32)/2, we would output the left buffer along with the unit, # and the unit would end up +left buffer width to the right of where it should be topleft = left - max(0, (image.get_width() - 16) / 2), top - 24 surf.blit(image, topleft) # ======= # Status Aura Icon if not self.unit.isDying and 'aura' in self.unit.status_bundle: aura_icon_name = self.unit.team + 'AuraIcon' aura_icon = GC.IMAGESDICT[ aura_icon_name] if aura_icon_name in GC.IMAGESDICT else GC.IMAGESDICT[ 'AuraIcon'] aura_icon = Engine.subsurface( aura_icon, (0, GC.PASSIVESPRITECOUNTER.count * 10, 32, 10)) topleft = (left - max(0, (aura_icon.get_width() - 16) / 2), top - max(0, (aura_icon.get_height() - 16) / 2) + 8) surf.blit(aura_icon, topleft) # Status always animationss for status in self.unit.status_effects: if status.always_animation: x, y = self.unit.position topleft = (x - 1) * GC.TILEWIDTH + self.spriteOffset[0], ( y - 1) * GC.TILEHEIGHT + self.spriteOffset[1] surf.blit(status.always_animation.image, topleft) if self.transition_state.startswith('warp'): num_frames = 12 fps = self.transition_time / num_frames frame = (self.transition_time - self.transition_counter) / fps if frame >= 0 and frame < num_frames: warp_anim = Engine.subsurface(GC.IMAGESDICT['Warp'], (frame * 32, 0, 32, 48)) topleft = (left - max(0, (warp_anim.get_width() - 16) / 2), top - max(0, (warp_anim.get_height() - 16) / 2) - 4) surf.blit(warp_anim, topleft) if gameStateObj.cursor.currentSelectedUnit and ( gameStateObj.cursor.currentSelectedUnit.name, self.unit.name) in gameStateObj.talk_options: frame = (Engine.get_time() / 100) % 8 topleft = (left + 6, top - 12) surf.blit( Engine.subsurface(GC.IMAGESDICT['TalkMarker'], (frame * 8, 0, 8, 16)), topleft)