Пример #1
0
    def __init__(self, image_pass, x_pos, y_pos, angle, shift_x, shift_y, beam_start, beam_scale, scale, switch):
        #original values
        self.image_location = image_pass
        self.image_pass = pygame.image.load(self.image_location)
        self.original_scale = scale
        self.original_x = x_pos
        self.original_y = y_pos
        self.original_angle = angle
        self.original_shift_x = shift_x
        self.original_shift_y = shift_y
        self.original_beam_start = beam_start
        self.original_beam_scale = beam_scale
        self.switch = switch

        w, h = self.image_pass.get_size()
        self.image = pygame.transform.scale(self.image_pass, (int(w * scale*resolution_factor()), int(h * scale*resolution_factor())))

        self.x = x_pos*resolution_factor()
        self.y = y_pos*resolution_factor()
        self.beam = [
            (0 + self.x + shift_x*resolution_factor(), beam_start*resolution_factor() + self.y + shift_y*resolution_factor()),
            (0 + self.x + shift_x*resolution_factor(), 0 + self.y + shift_y*resolution_factor()),
            (1500*resolution_factor() + self.x + shift_x*resolution_factor(), -beam_scale*beam_start*resolution_factor() + self.y + shift_y*resolution_factor()),
            (1500*resolution_factor() + self.x + shift_x*resolution_factor(), beam_scale*beam_start*resolution_factor() + self.y + shift_y*resolution_factor())
        ]
        self.beam = rotate_polygon(self.beam, angle, self.beam[0])
        self.on = True
        self.rect = self.image.get_rect()
        self.rect.x = self.x
        self.rect.y = self.y
        self.display_key = False
        self.key = pygame.key.name(controls.interact)
Пример #2
0
    def resize(self):
        w, h = self.image_pass.get_size()
        self.image = pygame.transform.scale(self.image_pass, (int(w * self.original_scale*resolution_factor()), int(h * self.original_scale*resolution_factor())))

        self.x = self.original_x*resolution_factor()
        self.y = self.original_y*resolution_factor()
        self.beam = [
            (0 + self.x + self.original_shift_x*resolution_factor(), self.original_beam_start*resolution_factor() + self.y + self.original_shift_y*resolution_factor()),
            (0 + self.x + self.original_shift_x*resolution_factor(), 0 + self.y + self.original_shift_y*resolution_factor()),
            (1500*resolution_factor() + self.x + self.original_shift_x*resolution_factor(), -self.original_beam_scale*self.original_beam_start*resolution_factor() + self.y + self.original_shift_y*resolution_factor()),
            (1500*resolution_factor() + self.x + self.original_shift_x*resolution_factor(), self.original_beam_scale*self.original_beam_start*resolution_factor() + self.y + self.original_shift_y*resolution_factor())
        ]
        self.beam = rotate_polygon(self.beam, self.original_angle, self.beam[0])
        self.rect = self.image.get_rect()
        self.rect.x = self.x
        self.rect.y = self.y
Пример #3
0
 def draw(self, main_surface, angle, sign, dark):
     super(Torch, self).item_draw(main_surface, angle, sign)
     if self.on:
         pygame.draw.polygon(dark, (0, 0, 0, 0), (rotate_polygon(self.light_list, (-sign * angle), (self.light_list[0][0] - 15*resolution_factor(), self.light_list[0][1]))))