def draw(self, surface): """ Draws the player to the target surface. """ if self.dead: return drawnImage, drawnRect = tools.rot_center(self.image, self.rect, self.rotAngle) tools.blit_alpha(surface, drawnImage, drawnRect.topleft, self.vapor)
def tilt(self, angle): # self.surf = pygame.transform.rotate(self.orig_surf, angle) # return self.surf # loc = self.surf.get_rect().center #rot_image is not defined # rot_sprite = pygame.transform.rotate(self.orig_surf, angle) # rot_sprite.get_rect().center = loc # self.surf = rot_sprite # return self.surf self.surf = tools.rot_center(self.orig_surf, angle) return self.surf
def set_angle(self, angle): self.angle = angle if self.bufimg != None: self.bufimg, self.bufrect = tools.rot_center(self.img, self.img.get_rect(), self.angle * 180 / math.pi)
def rotate_gun_to(self, angle): self.aim_direction = angle % (math.pi * 2) if self.top_bufimg != None: self.top_bufimg, self.top_bufrect = tools.rot_center(self.top_img, self.top_img.get_rect(), self.aim_direction * 180 / math.pi)
def set_angle(self, angle): self.angle = angle if self.bufimg != None: self.bufimg, self.bufrect = tools.rot_center( self.img, self.img.get_rect(), self.angle * 180 / math.pi)
def rotate_gun_to(self, angle): self.aim_direction = angle % (math.pi * 2) if self.top_bufimg != None: self.top_bufimg, self.top_bufrect = tools.rot_center( self.top_img, self.top_img.get_rect(), self.aim_direction * 180 / math.pi)