예제 #1
0
	def __init__(self, engine, screen_size):
		super(Graphics, self).__init__(engine)
		self.screen_size = screen_size
		self.SCREEN = pygame.display.set_mode(screen_size)
		self.BLACK_SCREEN = pygame.Surface(screen_size)

		self.camera_pos = [0, 0]
		self.camera_center_rect = None
		pygame.font.init()
		self.font =  pygame.font.Font(j_path("Other Resources", "Actor-Regular.ttf"), 14)
		self.small_font = pygame.font.Font(j_path("Other Resources", "Actor-Regular.ttf"), 7)
예제 #2
0
	def __init__(self):
		super(LookComponent, self).__init__()

		# Initialize all Animation objects:
		self.animations = {}
		walk_r_imgs = split_tiled_image(pygame.image.load(j_path("images", "spearhead", "ANI_walk_r.png")).convert_alpha(), (24, 16))
		self.animations["walk_right"] = Animation(walk_r_imgs, [(2, 15), (0, 15), (1, 15), (0, 15)])
		self.animations["walk_left"] = self.animations["walk_right"].make_x_mirror()

		self.animations["stand_right"] = Animation(walk_r_imgs, [0, 600])
		self.animations["stand_left"] = self.animations["stand_right"].make_x_mirror()

		turn_imgs = split_tiled_image(pygame.image.load(j_path("images", "spearhead", "ANI_turn_l.png")).convert_alpha(), (24, 16))
		self.animations["turn_left"] = Animation(turn_imgs, [(0,8), (1, 4), (0, 8), (1, 4), (0, 15), (1, 2), (0, 8), (2, 8), (3, 8), (4, 8), (5, 30), (5, 1)])
		self.animations["turn_right"] = self.animations["turn_left"].make_x_mirror()

		# Save the current animation
		self.current_animation = self.animations["stand_right"]
		# Save the last animation to check if a new animation has started:
		self.current_animation_name = "stand_right"
		# Play the current animation
		self.current_animation.play()
예제 #3
0
    def __init__(self):
        super(LookComponent, self).__init__()

        # Initialize all Animation objects:
        self.animations = {}
        self.animations["stand_right"] = Animation(
            split_tiled_image(pygame.image.load(j_path("images", "ANI_Wario_stand_r.png")).convert_alpha(), (20, 29)),
            [(0, 250), (1, 100), (2, 5), (1, 20), (2, 10), (1, 100)],
        )
        self.animations["stand_left"] = self.animations["stand_right"].make_x_mirror()

        self.animations["walk_right"] = Animation(
            split_tiled_image(pygame.image.load(j_path("images", "ANI_Wario_walk_r.png")).convert_alpha(), (24, 29)), 5
        )
        self.animations["walk_left"] = self.animations["walk_right"].make_x_mirror()

        self.animations["jump_right"] = Animation(
            [pygame.image.load(j_path("images", "ANI_Wario_jump_r.png")).convert_alpha()], 1
        )
        self.animations["jump_left"] = self.animations["jump_right"].make_x_mirror()

        # Load images for the next couple of animations:
        gotosleep_imgs = split_tiled_image(
            pygame.image.load(j_path("images", "ANI_Wario_gotosleep_r.png")).convert_alpha(), (28, 30)
        )

        self.animations["gotosleep_right"] = Animation(gotosleep_imgs, [(0, 15), (1, 15), (2, 15), (3, 15), (4, 15)])
        self.animations["gotosleep_left"] = self.animations["gotosleep_right"].make_x_mirror()

        self.animations["sleep_right"] = Animation(gotosleep_imgs, [(4, 30), (5, 20), (6, 100), (5, 20)])
        self.animations["sleep_left"] = self.animations["sleep_right"].make_x_mirror()

        self.animations["wakeup_right"] = Animation(gotosleep_imgs, [(4, 25), (3, 25), (2, 25), (1, 25), (0, 25)])
        self.animations["wakeup_left"] = self.animations["wakeup_right"].make_x_mirror()

        turn_around_img = split_tiled_image(
            pygame.image.load(j_path("images", "ANI_Wario_turn.png")).convert_alpha(), (28, 29), (225, 0, 225)
        )
        self.animations["turn_left"] = Animation(turn_around_img, [(3, 4), (2, 4), (1, 4)])
        self.animations["turn_right"] = Animation(turn_around_img, [(1, 4), (2, 4), (3, 4)])

        fist_img = split_tiled_image(
            pygame.image.load(j_path("images", "ANI_Wario_softfist_l.png")).convert_alpha(), (32, 30)
        )
        self.animations["fist_left"] = Animation(fist_img, 3)
        self.animations["fist_right"] = self.animations["fist_left"].make_x_mirror()

        # Save the current animation
        self.current_animation = self.animations["stand_right"]
        # Save the last animation to check if a new animation has started:
        self.current_animation_name = "stand_right"
        # Play the current animation
        self.current_animation.play()
예제 #4
0
    def __init__(self):
        super(LookComponent, self).__init__()

        # Initialize all Animation objects:
        self.animations = {}
        self.animations["stand_right"] = Animation(
            split_tiled_image(
                pygame.image.load(j_path(
                    "images", "ANI_Wario_stand_r.png")).convert_alpha(),
                (20, 29)), [(0, 250), (1, 100), (2, 5), (1, 20), (2, 10),
                            (1, 100)])
        self.animations["stand_left"] = self.animations[
            "stand_right"].make_x_mirror()

        self.animations["walk_right"] = Animation(
            split_tiled_image(
                pygame.image.load(j_path(
                    "images", "ANI_Wario_walk_r.png")).convert_alpha(),
                (24, 29)), 5)
        self.animations["walk_left"] = self.animations[
            "walk_right"].make_x_mirror()

        self.animations["jump_right"] = Animation([
            pygame.image.load(j_path("images",
                                     "ANI_Wario_jump_r.png")).convert_alpha()
        ], 1)
        self.animations["jump_left"] = self.animations[
            "jump_right"].make_x_mirror()

        # Load images for the next couple of animations:
        gotosleep_imgs = split_tiled_image(
            pygame.image.load(j_path(
                "images", "ANI_Wario_gotosleep_r.png")).convert_alpha(),
            (28, 30))

        self.animations["gotosleep_right"] = Animation(gotosleep_imgs,
                                                       [(0, 15), (1, 15),
                                                        (2, 15), (3, 15),
                                                        (4, 15)])
        self.animations["gotosleep_left"] = self.animations[
            "gotosleep_right"].make_x_mirror()

        self.animations["sleep_right"] = Animation(gotosleep_imgs, [(4, 30),
                                                                    (5, 20),
                                                                    (6, 100),
                                                                    (5, 20)])
        self.animations["sleep_left"] = self.animations[
            "sleep_right"].make_x_mirror()

        self.animations["wakeup_right"] = Animation(gotosleep_imgs, [(4, 25),
                                                                     (3, 25),
                                                                     (2, 25),
                                                                     (1, 25),
                                                                     (0, 25)])
        self.animations["wakeup_left"] = self.animations[
            "wakeup_right"].make_x_mirror()

        turn_around_img = split_tiled_image(
            pygame.image.load(j_path("images",
                                     "ANI_Wario_turn.png")).convert_alpha(),
            (28, 29), (225, 0, 225))
        self.animations["turn_left"] = Animation(turn_around_img, [(3, 4),
                                                                   (2, 4),
                                                                   (1, 4)])
        self.animations["turn_right"] = Animation(turn_around_img, [(1, 4),
                                                                    (2, 4),
                                                                    (3, 4)])

        fist_img = split_tiled_image(
            pygame.image.load(j_path(
                "images", "ANI_Wario_softfist_l.png")).convert_alpha(),
            (32, 30))
        self.animations["fist_left"] = Animation(fist_img, 3)
        self.animations["fist_right"] = self.animations[
            "fist_left"].make_x_mirror()

        # Save the current animation
        self.current_animation = self.animations["stand_right"]
        # Save the last animation to check if a new animation has started:
        self.current_animation_name = "stand_right"
        # Play the current animation
        self.current_animation.play()