Beispiel #1
0
def draw():
    global fade_image
    global image
    global ready_font
    global blink_str
    global fade_timer

    pico2d.clear_canvas()

    if fade_timer > 0.0:
        image.draw(pico2d.get_canvas_width() // 2, pico2d.get_canvas_height() // 2)

        if blink_str > 1.2:
            blink_str = 0.0
            pass
        elif blink_str <= 0.6:
            pass
        elif blink_str <= 1.2:
            ready_font.draw(pico2d.get_canvas_width()//2, pico2d.get_canvas_height()//2 // 2 // 2, str("Press Enter"))
            pass

    if fade_timer < 0.0:
        fade_timer = 0.0
    fade_image.opacify(1.0 - fade_timer)
    fade_image.clip_draw(0, 0, pico2d.get_canvas_width(), pico2d.get_canvas_height(), 0, 0, pico2d.get_canvas_width() * 3, pico2d.get_canvas_height() * 3)

    pico2d.update_canvas()
    pass
Beispiel #2
0
    def draw(self):
        shovel_frame_start_point = Point(
            self.FRAME_IMAGE_WIDTH * 0 + self.FRAME_IMAGE_INTERVAL * 0,
            self.frame_image.h - 54 - self.FRAME_IMAGE_HEIGHT)
        attack_frame_start_point = Point(
            self.FRAME_IMAGE_WIDTH * 1 + self.FRAME_IMAGE_INTERVAL * 1,
            self.frame_image.h - 54 - self.FRAME_IMAGE_HEIGHT)
        # 삽 틀
        self.frame_image.clip_draw(
            shovel_frame_start_point.x, shovel_frame_start_point.y,
            self.FRAME_IMAGE_WIDTH, self.FRAME_IMAGE_HEIGHT, self.pivot.x,
            self.pivot.y, self.FRAME_IMAGE_WIDTH * IMAGE_SCALE,
            self.FRAME_IMAGE_HEIGHT * IMAGE_SCALE)

        # 공격아이템 틀
        self.frame_image.clip_draw(
            attack_frame_start_point.x, attack_frame_start_point.y,
            self.FRAME_IMAGE_WIDTH, self.FRAME_IMAGE_HEIGHT,
            self.pivot.x + self.FRAME_PIVOT_INTERVAL, self.pivot.y,
            self.FRAME_IMAGE_WIDTH * IMAGE_SCALE,
            self.FRAME_IMAGE_HEIGHT * IMAGE_SCALE)

        # 삽 아이템
        if self.shovel_type != Shovel_Type['SHOVEL_NULL']:
            item_pivot = Point(50, pico2d.get_canvas_height() - 40)
            shovel_start_point = Point(
                self.SHOVEL_IMAGE_WIDTH * self.shovel_type +
                self.WEAPON_IMAGE_INTERVAL * self.shovel_type,
                self.shovel_image.h - 2 - self.SHOVEL_IMAGE_HEIGHT)

            self.shovel_image.clip_draw(shovel_start_point.x,
                                        shovel_start_point.y,
                                        self.SHOVEL_IMAGE_WIDTH,
                                        self.SHOVEL_IMAGE_HEIGHT, item_pivot.x,
                                        item_pivot.y,
                                        self.SHOVEL_IMAGE_WIDTH * IMAGE_SCALE,
                                        self.SHOVEL_IMAGE_HEIGHT * IMAGE_SCALE)
            pass

        if self.weapon_type != Weapon_Type['WEAPON_NULL']:
            item_pivot = Point(50 + 70, pico2d.get_canvas_height() - 40)
            weapon_start_point = Point(
                self.WEAPON_IMAGE_WIDTH * self.weapon_type +
                self.WEAPON_IMAGE_INTERVAL * self.weapon_type,
                self.weapon_image.h - 4 - self.WEAPON_IMAGE_HEIGHT)

            self.weapon_image.clip_draw(weapon_start_point.x,
                                        weapon_start_point.y,
                                        self.WEAPON_IMAGE_WIDTH,
                                        self.WEAPON_IMAGE_HEIGHT, item_pivot.x,
                                        item_pivot.y,
                                        self.WEAPON_IMAGE_WIDTH * IMAGE_SCALE,
                                        self.WEAPON_IMAGE_HEIGHT * IMAGE_SCALE)
            pass
        pass
Beispiel #3
0
    def __init__(self):
        self.image = pico2d.load_image('resource\\UI.png')
        self.font = pico2d.load_font('resource\\2dgp-money-cnt.ttf', 15)
        self.holding_gold = 0
        self.holding_diamond = 0
        self.pivot = Point(0, 0)

        self.gold_pivot = Point(pico2d.get_canvas_width() - 90,
                                pico2d.get_canvas_height() - 35)
        self.diamond_pivot = Point(pico2d.get_canvas_width() - 90,
                                   pico2d.get_canvas_height() - 85)
Beispiel #4
0
    def __init__(self):
        self.image = pico2d.load_image('resource\\UI.png')
        self.pivot = Point(pico2d.get_canvas_width() // 2,
                           pico2d.get_canvas_height() // 8)
        self.frame = 0

        self.timer = 0.0
Beispiel #5
0
 def get_cloud_position(self):
     self.direction = random.randint(0,1)
     if self.direction == Cloud.DIRECTION_LEFT:
         self.x = (Cloud.image_half_width * self.scale) + pico2d.get_canvas_width()
     else:
         self.x = -(Cloud.image_half_width * self.scale)
     self.y = random.randint(8, 10) * 0.1 * pico2d.get_canvas_height()
Beispiel #6
0
    def __init__(self):
        self.image = pico2d.load_image('resource\\black_background.jpg')
        self.canvas_width = pico2d.get_canvas_width()
        self.canvas_height = pico2d.get_canvas_height()

        self.window_left = 0
        self.window_bottom = 0

        self.w = self.image.w
        self.h = self.image.h
        self.focus_object = None
def draw():
    pico2d.clear_canvas()

    for game_object, object_layer in GameWorldManager.all_objects():
        game_object.draw()

    clear_font.draw(
        pico2d.get_canvas_width() // 2 + SHADOW_RANGE,
        pico2d.get_canvas_height() // 2 + pico2d.get_canvas_height() // 4 -
        SHADOW_RANGE, str("GAME CLEAR"), (0, 0, 0))
    clear_font.draw(
        pico2d.get_canvas_width() // 2,
        pico2d.get_canvas_height() // 2 + pico2d.get_canvas_height() // 4,
        str("GAME CLEAR"), (255, 255, 255))

    clear_font.draw(500 + SHADOW_RANGE,
                    pico2d.get_canvas_height() // 2 - SHADOW_RANGE,
                    str("Game Score : "), (0, 0, 0))
    clear_font.draw(500,
                    pico2d.get_canvas_height() // 2, str("Game Score : "),
                    (255, 255, 255))

    clear_score_font.draw(
        pico2d.get_canvas_width() - 500 + SHADOW_RANGE,
        pico2d.get_canvas_height() // 2 - SHADOW_RANGE,
        "%d" % MainState.BlackBoard['player']['holding_gold'], (0, 0, 0))
    clear_score_font.draw(
        pico2d.get_canvas_width() - 500,
        pico2d.get_canvas_height() // 2,
        "%d" % MainState.BlackBoard['player']['holding_gold'], (55, 55, 55))

    clear_message_font.draw(pico2d.get_canvas_width() // 2 + SHADOW_RANGE,
                            pico2d.get_canvas_height() // 8 - SHADOW_RANGE,
                            str("게임을 종료하려면 ESC 키를 누르세요"), (0, 0, 0))
    clear_message_font.draw(pico2d.get_canvas_width() // 2,
                            pico2d.get_canvas_height() // 8,
                            str("게임을 종료하려면 ESC 키를 누르세요"), (255, 255, 255))

    pico2d.update_canvas()
    pass
Beispiel #8
0
    def __init__(self):
        self.frame_image = pico2d.load_image('resource\\UI.png')
        self.shovel_image = pico2d.load_image('resource\\Item_Shovel.png')
        self.weapon_image = pico2d.load_image('resource\\Item_Weapon.png')
        self.body_image = None
        self.head_image = None

        self.pivot = Point(
            50,
            pico2d.get_canvas_height() - self.FRAME_IMAGE_HEIGHT - 3)
        self.shovel_type = 0
        self.weapon_type = 0
        self.body_type = None
        self.head_type = None
Beispiel #9
0
def draw():
    global camera

    pico2d.clear_canvas()
    for game_object, object_layer in GameWorldManager.all_objects():
        if object_layer == LAYER_BACKGROUND or object_layer == LAYER_MESSAGE or object_layer == LAYER_UI:
            game_object.draw()
            pass

        else:
            if camera.check_object_in_camera(game_object.pivot.x,
                                             game_object.pivot.y):
                view_val = check_object_view(game_object.pivot.x,
                                             game_object.pivot.y)
                if view_val == 0:
                    game_object.alpha_value = 0.0
                    game_object.draw()
                    pass
                elif view_val == 1:
                    game_object.alpha_value = 0.3
                    game_object.draw()
                    pass
                elif view_val == 2:
                    game_object.alpha_value = 0.8
                    game_object.draw()
                else:
                    game_object.alpha_value = 1.0
                    pass

    fade_image.opacify(fade_timer)
    fade_image.clip_draw(0, 0, pico2d.get_canvas_width(),
                         pico2d.get_canvas_height(), 0, 0,
                         pico2d.get_canvas_width() * 3,
                         pico2d.get_canvas_height() * 3)

    pico2d.update_canvas()
    pass
Beispiel #10
0
    def __init__(self):
        self.image = pico2d.load_image('resource\\black_background.jpg')
        self.canvas_width = pico2d.get_canvas_width()
        self.canvas_height = pico2d.get_canvas_height()
        self.w = self.image.w
        self.h = self.image.h

        self.focus_object = None
        self.window_left = 0
        self.window_bottom = 0

        self.q1l, self.q1b, self.q1w, self.q1h = 0, 0, 0, 0
        self.q2l, self.q2b, self.q2w, self.q2h = 0, 0, 0, 0
        self.q3l, self.q3b, self.q3w, self.q3h = 0, 0, 0, 0
        self.q4l, self.q4b, self.q4w, self.q4h = 0, 0, 0, 0
    def __init__(self):
        self.image = pico2d.load_image('resource\\black_background.jpg')
        self.canvas_width = pico2d.get_canvas_width()
        self.canvas_height = pico2d.get_canvas_height()

        self.window_left = 0
        self.window_bottom = 0

        self.pivot = Point(self.window_left, self.window_bottom)

        self.w = self.image.w
        self.h = self.image.h

        self.focus_object = None

        # Camera Shake
        self.check_shaking_camera = False
        self.shaking_timer = Camera.SHAKE_TIMER
        pass
 def __init__(self):
     self.image = pico2d.load_image('resource\\hit_background.png')
     self.canvas_width = pico2d.get_canvas_width()
     self.canvas_height = pico2d.get_canvas_height()
Beispiel #13
0
 def __init__(self):
     self.image = pico2d.load_image('resource\\UI.png')
     self.pivot = Point(920, pico2d.get_canvas_height() - 35)
     self.curr_hp = 0
     self.max_hp = 0