Example #1
0
    def __init__(self, running_open=None, px=None, py=None):
        if NextFloor.image is None:
            NextFloor.image = pico2d.load_image('resource\\Block_Floors.png')
            NextFloor.shadow_image = pico2d.load_image(
                'resource\\black_background.png')

        self.alpha_value = 1.0

        if px is None and py is None:
            self.pivot = Point(500, 500)
        else:
            self.pivot = Point(px, py)

        if running_open is None:
            self.value = Block_Type['BLOCK_STAIR_CLOSED']
            self.running_open = False

        if running_open:
            self.value = Block_Type['BLOCK_STAIR_OPENED']
            self.running_open = True
        else:
            self.value = Block_Type['BLOCK_STAIR_CLOSED']
            self.running_open = False

        self.open_sound = pico2d.load_wav(
            'resource\\sound\\obj_sound\\sfx_use_key_to_unlock.wav')
    def __init__(self):
        if Monster.hp_image is None:
            Monster.hp_image = pico2d.load_image('resource\\UI.png')
            Monster.shadow_image = pico2d.load_image(
                'resource\\black_background.png')
        self.full_hp_image_start_point = Point(227, Monster.hp_image.h - 40)
        self.empty_hp_image_start_point = Point(241, Monster.hp_image.h - 40)

        self.pivot = Point(0, 0)
        self.start_pivot = Point(0, 0)
        self.alpha_value = 1.0

        self.type = None
        self.curr_hp = None
        self.max_hp = None
        self.damage = None

        self.object_width = None
        self.object_height = None

        self.image_start_point = None
        self.frame = None
        self.max_frame = None

        self.dir = None
        self.timer = None
        self.bt = None
    def __init__(self, level):
        self.x = random.randint(ROAD_L + 100, ROAD_R - 100)
        self.y = random.randint(-100, 0) if random.randint(
            0, 1) else random.randint(600, ch + 100)
        self.accel = 0
        self.dir = 0
        self.level = level
        self.max_speed = garage_state.car_info[str(self.level)]['speed']
        self.y_speed = random.uniform(1.0, self.max_speed)
        self.x_speed = 0
        self.state = STOP
        self.frame = 0
        self.frame_timer = 0
        self.draw_timer = 0
        self.draw_interval = 0.05
        self.max_frame = garage_state.car_info[str(self.level)]['frame']
        self.image = None
        if Car.images[self.level] == None:
            Car.images[self.level] = pico2d.load_image('res/img/lv_%d.png' %
                                                       self.level)
            Car.images_h[self.level] = pico2d.load_image(
                'res/img/lv_%d_h.png' % self.level)
            print('image: car lv%d' % self.level)
        self.image = Car.images[self.level]
        self.image_h = Car.images_h[self.level]
        self.WIDTH = self.image.w
        self.HEIGHT = self.image.h // self.max_frame

        self.hit = False  #맞았을때 효과이미지 출력용
        self.max_hp = garage_state.car_info[str(self.level)]['hp']
        self.hp = self.max_hp
    def __init__(self):
        if Garage.lock == None:
            Garage.lock = pico2d.load_image('res/img/lock.png')
        self.slot = [0, 1, 2]
        self.slot_imgs = [
            pico2d.load_image('res/img/slot_lv%d.png' % i)
            for i in range(MAX_LEV)
        ]
        self.select = 0
        self.coin = Coin(330, 400)
        self.p_lev = player_info['level']
        self.msg = '탑승가능'
        self.able = True
        self.btn_start = ui.Button('res/img/racestart', 600, 100, onClick,
                                   'racestart')
        self.btn_buy = ui.Button('res/img/buy', 600, 100, onClick, 'buy')
        self.btn = [\
                self.btn_start,\
                ui.Button('res/img/before', 200, 100, onClick, 'before'),\
                ui.Button('res/img/left_arrow', 50, 500, onClick, 'la'),\
                ui.Button('res/img/right_arrow', 750, 500, onClick, 'ra'),\
                ui.Button('res/img/slot', 200, 500, onClick, 's1'),\
                ui.Button('res/img/slot', 400, 500, onClick, 's2'),\
                ui.Button('res/img/slot', 600, 500, onClick, 's3'),\
                ui.Button('res/img/left_arrow', 500, 250, onClick, 'diff_down'),\
                ui.Button('res/img/right_arrow', 750, 250, onClick, 'diff_up'),\
                ]
        self.lbl = []

        self.difficulty = 0
Example #5
0
 def draw(self):
     self.image_class[self.frame_mode].draw_image(self.position_on_window.x,
                                                  self.position_on_window.y)
     image = None
     if self.team == UNIT_TEAM_PLAYER:
         image = pico2d.load_image('resource/UI/hp_bar_player.png')
     elif self.team == UNIT_TEAM_ENEMY:
         image = pico2d.load_image('resource/UI/hp_bar_enemy.png')
     image.clip_draw(0, 0, 64, 64, self.position_on_window.x,
                     self.position_on_window.y - 32,
                     self.status.current_hp / self.status.max_hp * 32, 10)
def load_image(tag):
    if tag in ResourceData.image_url_dic:
        if ResourceData.image_url_dic[tag] in ResourceData.image_cache:
            ret_image = ResourceData.image_cache[
                ResourceData.image_url_dic[tag]]
        else:
            complete_url = ResourceData.image_base_dir_url + ResourceData.image_url_dic[
                tag]
            ret_image = pico2d.load_image(complete_url)
            ResourceData.image_cache[
                ResourceData.image_url_dic[tag]] = ret_image
        return ret_image
    else:
        return pico2d.load_image(tag)
Example #7
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
Example #8
0
def enter_state():
    global fade_image
    global image
    global ready_font
    global ready_bgm

    fade_image = pico2d.load_image('resource\\black_background.png')
    image = pico2d.load_image('resource\\start_image.jpg')
    ready_font = pico2d.load_font('resource\\NecroSans.ttf', 56)

    ready_bgm = pico2d.load_wav('resource\\sound\\start_bgm.wav')
    ready_bgm.set_volume(35)
    ready_bgm.repeat_play()

    pass
Example #9
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
Example #10
0
 def __init__(self):
     self.x = random.randint(-100, 100) if random.randint(
         0, 1) else random.randint(cw - 100, cw + 100)
     self.y = random.randint(0, ch)
     if Tree.image == None:
         Tree.image = pico2d.load_image('res/tree.png')
         print('Tree', self.image)
Example #11
0
    def __init__(self, selected_block=None, px=None, py=None):
        if Block.image is None:
            Block.image = pico2d.load_image('resource\\Block_Floors.png')
            Block.shadow_image = pico2d.load_image(
                'resource\\black_background.png')
        self.alpha_value = 1.0

        if px is None and py is None:
            self.pivot = Point(500, 500)
        else:
            self.pivot = Point(px, py)

        if selected_block is None:
            self.value = Block_Type['BLOCK_BASIC_STRONG_COLOR_1']
        else:
            self.value = selected_block
Example #12
0
    def __init__(self):
        CharacterData.__init__(self)
        #super(CharacterData, self).__init__()
        self.load('Resources/Sprites/Finn.json')
        
        self.x = 320
        self.y = 480
        self.speed = Finn.MPS
        self.frame_time = 0.05

        if Finn.image is None:
            Finn.image = pico2d.load_image(self.name)
            #pico2d_extension.set_texture_color(Finn.image.texture, 255, 255, 255)
        if Finn.sounds is None:
            Finn.sounds = []
            damage_sound = pico2d.load_wav('Resources/Sounds/Damage01.wav')
            damage_sound.set_volume(32)
            Finn.sounds.append(damage_sound)
            
            damage_sound = pico2d.load_wav('Resources/Sounds/Damage02.wav')
            damage_sound.set_volume(32)
            Finn.sounds.append(damage_sound)

            damage_sound = pico2d.load_wav('Resources/Sounds/Damage03.wav')
            damage_sound.set_volume(32)
            Finn.sounds.append(damage_sound)
Example #13
0
    def __init__(self, item_type=None, px=None, py=None):
        if Dropped_Item.shadow_image is None:
            Dropped_Item.shadow_image = pico2d.load_image(
                'resource\\black_background.png')

        if Dropped_Item.get_sound is None:
            Dropped_Item.get_sound = pico2d.load_wav(
                'resource\\sound\\obj_sound\\sfx_pickup_general_ST.wav')
            self.get_sound.set_volume(100)
            pass

        self.alpha_value = 1.0

        if px is None and py is None:
            self.pivot = Point(500, 500)
        else:
            self.pivot = Point(px, py + 10)

        if item_type is None:
            self.value = DroppedItem_Type['ITEM_GOLD']
        else:
            self.value = item_type

        self.image_start_point = None

        self.jump_max = 5
        self.starting_y = self.pivot.y
        self.dir = 1
        self.timer = self.MOVING_TIMER
Example #14
0
    def __init__(self, selected_wall=None, px=None, py=None):
        if Wall.image is None:
            Wall.image = pico2d.load_image('resource\\Block_Walls.png')
            Wall.shadow_image = pico2d.load_image(
                'resource\\black_background.png')
        self.alpha_value = 1.0

        if px is None and py is None:
            self.pivot = Point(400, 500)
        else:
            self.pivot = Point(px, py)

        if selected_wall is None:
            self.value = Wall_Type['WALL_BASIC_1']
        else:
            self.value = selected_wall
Example #15
0
 def __init__(self):
     super().__init__("Apple")
     self.image = pico2d.load_image("../Resources/stage/apple.png")
     self.id = 5
     self.pivotX = 0
     self.pivotY = 30
     self.type = 4
     self.max_frame = 1
Example #16
0
 def __init__(self, x, y):
     self.x, self.y = x, y
     self.frame = 0
     if Explosion.image == None:
         Explosion.image = pico2d.load_image('res/img/Explosion.png')
         print('Explosion', Explosion.image)
     self.st, self.ed = time.time(), 0
     self.end = False
Example #17
0
 def __init__(self, x, y):
     self.x, self.y = x, y
     self.frame = 0
     self.y_speed = 10
     self.x_speed = 10
     if Coin.image == None:
         Coin.image = pico2d.load_image('res/coin.png')
         print('Coin', self.image)
Example #18
0
 def __init__(self, x, y):
     self.x, self.y = x, y
     self.frame = 0
     self.speed = 10
     self.end = False
     if Coin.image == None:
         Coin.image = pico2d.load_image('res/img/coin.png')
         print('Coin', self.image)
     self.st, self.ed = time.time(), 0
Example #19
0
 def __init__(self):
     if Road.image == None:
         Road.image = pico2d.load_image('res/img/road.png')
         print('Road', self.image)
     self.x = Road.image.w // 2
     self.y = Road.image.h // 2
     self.y_lower = -ch
     self.y_upper = ch
     self.dx = 0
Example #20
0
    def __init__(self,x,y):
        EffectData.__init__(self)
        self.load('Resources/Effects/Damage.json')

        self.x = x
        self.y = y

        if DamageEffect.image is None:
            DamageEffect.image = pico2d.load_image(self.name)
Example #21
0
 def Init(self):
     self.BackGroundE = p2.load_image('BackGroundE.png')
     self.GoButtonE = p2.load_image('GoButtonE.png')
     self.WallE = p2.load_image('WallE.png')
     self.LeftButtonE = p2.load_image('LeftButtonE.png')
     self.RightButtonE = p2.load_image('RightButtonE.png')
     self.GameLogoE = p2.load_image('GameLogoE.png')
     self.PressSpaceE = p2.load_image('PressSpaceE.png')
Example #22
0
 def Init(self):
     self.BackGroundM = p2.load_image('BackGroundM.png')
     self.GoButtonM = p2.load_image('GoButtonM.png')
     self.WallM = p2.load_image('WallM.png')
     self.LeftButtonM = p2.load_image('LeftButtonM.png')
     self.RightButtonM = p2.load_image('RightButtonM.png')
     self.GameLogoM = p2.load_image('GameLogoM.png')
     self.PressSpaceM = p2.load_image('PressSpaceM.png')
Example #23
0
 def Init(self):
     self.BackGroundH = p2.load_image('BackGroundH.png')
     self.GoButtonH = p2.load_image('GoButtonH.png')
     self.WallH = p2.load_image('WallH.png')
     self.LeftButtonH = p2.load_image('LeftButtonH.png')
     self.RightButtonH = p2.load_image('RightButtonH.png')
     self.GameLogoH = p2.load_image('GameLogoH.png')
     self.PressSpaceH = p2.load_image('PressSpaceH.png')
Example #24
0
 def __init__(self):
     super().__init__("새끼오징어")
     self.image = pico2d.load_image("../Resources/stage/babysquidStage.png")
     self.imageWidth = self.image.w
     self.imageHeight = self.image.h
     self.clipWidth = self.imageWidth // 2
     self.clipHeight = self.imageHeight
     self.id = 2
     self.pivotX = 0
     self.pivotY = 70
Example #25
0
 def __init__(self):
     super().__init__("FIREMAN")
     self.image = pico2d.load_image("../Resources/stage/firemanStage.png")
     self.imageWidth = self.image.w
     self.imageHeight = self.image.h
     self.clipWidth = self.imageWidth // 2
     self.clipHeight = self.imageHeight
     self.id = 8
     self.pivotX = 0
     self.pivotY = 70
Example #26
0
 def __init__(self, x, y, angle):
     if Bullet.image == None:
         Bullet.image = pico2d.load_image('res/img/bullet.png')
     self.WIDTH = Bullet.image.w
     self.HEIGHT = Bullet.image.h
     self.x = x
     self.y = y
     self.speed = 20
     self.xspeed = self.speed * math.cos(angle)
     self.yspeed = self.speed * math.sin(angle)
Example #27
0
    def __init__(self):
        ParticleData.__init__(self)
        #super(ParticleData, self).__init__()
        
        if not Maple.images:
            Maple.images.append(pico2d.load_image('Resources/Particles/Maple_01.png'))
            Maple.images.append(pico2d.load_image('Resources/Particles/Maple_02.png'))

        self.x = random.randint(0, game_framework.width)
        self.y = game_framework.height + random.randint(0, 10)
        self.type = random.randint(0,1)
        self.min_speed = Maple.MPS
        self.max_speed = Maple.MPS * 2
        self.speed = random.randint(self.min_speed, self.max_speed)
        self.scale = random.randint(5,10) * 0.1
        self.width = Maple.images[self.type].w
        self.height = Maple.images[self.type].h

        self.origin_x = self.x
        self.angle = 0
    def __init__(self):
        self.image = pico2d.load_image('resource\\Character_Player.png')
        self.pivot = Point(1000, 345)
        self.frame = {'x': 0, 'y': 0}
        self.rad = 0
        self.flip = ''

        # for jump
        self.check_jumping = False
        self.jumping_count = 0
        self.start_point = self.pivot
        self.mid_point = self.pivot
        self.end_point = self.pivot
        self.jump_dir = 'RIGHT'
        self.start_jumping_time = 0.0
        self.check_moving_collide = False

        self.event_que = []
        self.init_state = IdleState
        self.curr_state = IdleState
        self.curr_state.enter_state(self, None)

        # hit_damage
        self.curr_hp = 12
        self.max_hp = 12

        self.check_get_damage = False
        self.get_damage_timer = self.HIT_TIMER
        self.get_damage_image = Camera.HitImage()

        # money
        self.holding_gold = 0
        self.holding_diamond = 0

        # attack
        self.equip_shovel = Shovel_Type['SHOVEL_TITANIUM']
        self.equip_weapon = Weapon_Type['WEAPON_DAGGER_BASIC']
        self.equip_weapon_object = Dagger_Attack(self.pivot.x, self.pivot.y)

        self.equip_body = 0
        self.equip_head = 0

        # sound
        self.hit_voice = []
        self.hit_bgm = pico2d.load_wav('resource\\sound\\hit_sound\\sfx_player_hit_ST.wav')
        self.hit_bgm.set_volume(100)
        for i in range(6):
            bgm = pico2d.load_wav('resource\\sound\\hit_sound\\vo_cad_hurt_0' + str(i+1) + '.wav')
            bgm.set_volume(90)
            self.hit_voice.append(bgm)
            pass

        # view
        self.view_range = 2
Example #29
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
Example #30
0
 def __init__(self):
     super().__init__("마시멜로우")
     self.image = pico2d.load_image(
         "../Resources/stage/mashmallowStage.png")
     self.imageWidth = self.image.w
     self.imageHeight = self.image.h
     self.clipWidth = self.imageWidth // 2
     self.clipHeight = self.imageHeight
     self.id = 5
     self.pivotX = 0
     self.pivotY = 30
Example #31
0
 def __init__(self):
     super().__init__("문")
     self.image = pico2d.load_image('../Resources/stage/door.png')
     self.imageWidth = self.image.w
     self.imageHeight = self.image.h
     self.clipWidth = self.imageWidth // 2
     self.clipHeight = self.imageHeight
     self.pivotX = 0
     self.pivotY = 40
     self.id = 6
     self.type = 2
Example #32
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)
Example #33
0
 def __init__(self):
     self.image = pico2d.load_image('res/road.png')
     print('Road', self.image)
     self.width = self.image.w
     self.height = self.image.h
     self.lx = cw / 2
     self.rx = self.lx + self.width
     self.dy = ch / 2
     self.uy = self.dy + self.height
     self.trees = [Tree() for i in range(TREE)]
     self.clouds = [Cloud() for i in range(CLOUD)]
Example #34
0
    def __init__(self,x,y):
        EffectData.__init__(self)
        self.load('Resources/Effects/Warp.json')

        self.x = x
        self.y = y

        if WarpEffect.image is None:
            WarpEffect.image = pico2d.load_image(self.name)
        if WarpEffect.sound is None:
            WarpEffect.sound = pico2d.load_wav('Resources/Sounds/Warp.wav')
            WarpEffect.sound.set_volume(64)
    def __init__(self):
        CharacterData.__init__(self)
        #super(CharacterData, self).__init__()
        self.load('Resources/Sprites/Terrorlight.json')

        self.x = random.randint(400, 500)
        self.y = random.randint(400, 500)
        self.speed = random.randint(3, 5) * Terrorlight.MPS
        self.state_range = (2,3,7,8)
        self.state = random.randint(1,8)
        self.frame_time = 0.05

        if Terrorlight.image is None:
            Terrorlight.image = pico2d.load_image(self.name)
Example #36
0
 def __init__(self):
     ParticleData.__init__(self)
     #super(ParticleData, self).__init__()
     
     if not Snow.image:
         Snow.image = pico2d.load_image('Resources/Particles/Snow.png')
         
     self.x = random.randint(0, game_framework.width)
     self.y = game_framework.height + random.randint(0, 30)
     self.type = random.randint(0,1)
     self.min_speed = Snow.MPS
     self.max_speed = Snow.MPS * 5
     self.speed = random.randint(self.min_speed, self.max_speed)
     self.scale = random.randint(1,5) * 0.1
     self.width = Snow.image.w
     self.height = Snow.image.h
Example #37
0
    def __init__(self):
        ParticleData.__init__(self)

        if not Cloud.image:
            Cloud.image = pico2d.load_image('Resources/Particles/Cloud.png')
            Cloud.image_half_width = Cloud.image.w // 2
            Cloud.image.opacify(0.7)

        self.get_cloud_position()

        self.min_speed = Cloud.MPS
        self.max_speed = Cloud.MPS * 5
        
        self.speed = random.randint(self.min_speed, self.max_speed)
        self.scale = random.randint(5, 10) * 0.1
        self.width = Cloud.image.w
        self.height = Cloud.image.h
Example #38
0
    def __init__(self):
        CharacterData.__init__(self)
        #super(CharacterData, self).__init__()
        self.load('Resources/Sprites/Cubchoo.json')

        self.x = random.randint(400, 500)
        self.y = random.randint(400, 500)
        self.speed = random.randint(1, 3) * Cubchoo.MPS
        self.state = random.randint(1,8)
        self.frame_time = 0.1

        if Cubchoo.image is None:
            Cubchoo.image = pico2d.load_image(self.name)
        if Cubchoo.hit_sound is None:
            Cubchoo.hit_sound = pico2d.load_wav('Resources/Sounds/Hit.wav')
            Cubchoo.hit_sound.set_volume(16)
        if Cubchoo.respone_sound is None:
            Cubchoo.respone_sound = pico2d.load_wav('Resources/Sounds/Respone.wav')
            Cubchoo.respone_sound.set_volume(8)
Example #39
0
def load_map(name):
    with open(name) as f:
        data = json.load(f)

        # https://github.com/bjorn/tiled/wiki/JSON-Map-Format
        map_data = MapData()

        # MAP ########################################################################
        # Number of tile columns
        map_data.width = data.get('width')
        # Number of tile rows
        map_data.height = data.get('height')

        # Map grid width.
        map_data.tilewidth = data.get('tilewidth')
        # Map grid height.
        map_data.tileheight = data.get('tileheight')

        map_data.mapwidth = map_data.width * map_data.tilewidth
        map_data.mapheight = map_data.height * (map_data.tileheight // 2)

        map_data.mapoffsetx = (game_framework.width - map_data.mapwidth) // 2
        map_data.mapoffsety = (game_framework.height - map_data.mapheight) // 2

        # Orthogonal, isometric, or staggered
        map_data.orientation = data.get('orientation')

        # Hex-formatted color (#RRGGBB) (Optional)
        map_data.backgroundcolor = data.get('backgroundcolor')

        # Rendering direction (orthogonal maps only)
        map_data.renderorder = data.get('renderorder')

        # Auto-increments for each placed object
        map_data.nextobjectid = data.get('nextobjectid')

        # LAYER ######################################################################
        # Array of Layers
        for layer in data.get('layers'):
            layer_data = LayerData()

            # Column count. Same as map width in Tiled Qt.
            layer_data.width = layer.get('width')
            # Row count. Same as map height in Tiled Qt.
            layer_data.height = layer.get('height')
        
            # Name assigned to this layer
            layer_data.name = layer.get('name')
            # "tilelayer", "objectgroup", or "imagelayer"
            layer_data.type = layer.get('type')

            # Whether layer is shown or hidden in editor
            layer_data.visible = layer.get('visible')

            # Horizontal layer offset. Always 0 in Tiled Qt.
            layer_data.x = layer.get('x')
            # Vertical layer offset. Always 0 in Tiled Qt.
            layer_data.y = layer.get('y')

            # TILE ###################################################################
            # Array of GIDs. tilelayer only.
            _data = layer.get('data')
            if _data is not None:
                if map_data.renderorder == 'right-up':
                    for i in range(layer_data.height):
                        line = [x for x in _data[i * layer_data.width : i * layer_data.width + layer_data.width]]
                        layer_data.data.append(line)
                elif map_data.renderorder == 'right-down':
                    for i in reversed(range(layer_data.height)):
                        line = [x for x in _data[i * layer_data.width : i * layer_data.width + layer_data.width]]
                        layer_data.data.append(line)
                elif map_data.renderorder == 'left-up':
                    for i in range(layer_data.height):
                        line = [x for x in reversed(_data[i * layer_data.width : i * layer_data.width + layer_data.width])]
                        layer_data.data.append(line)
                elif map_data.renderorder == 'left-down':
                    for i in reversed(range(layer_data.height)):
                        line = [x for x in reversed(_data[i * layer_data.width : i * layer_data.width + layer_data.width])]
                        layer_data.data.append(line)

            ##########################################################################

            # OBJECT #################################################################
            # Array of Objects. objectgroup only.
            objects = layer.get('objects')
            if objects is not None:
                for object in objects:
                    object_data = ObjectData()

                    # Incremental id - unique across all objects
                    object_data.id = object.get('id')

                    # Width in pixels. Ignored if using a gid.
                    object_data.width = object.get('width')
                    # Height in pixels. Ignored if using a gid.
                    object_data.height = object.get('height')

                    # String assigned to name field in editor
                    object_data.name = object.get('name')
                    # String assigned to type field in editor
                    object_data.type = object.get('type')

                    # Whether object is shown in editor.
                    object_data.visible = object.get('visible')

                    # x coordinate in pixels
                    object_data.x = object.get('x')
                    # y coordinate in pixels
                    object_data.y = object.get('y')

                    # Angle in degrees clockwise
                    object_data.rotation = object.get('rotation')

                    # GID, only if object comes from a Tilemap
                    object_data.gid = object.get('gid')

                    layer_data.objects.append(object_data)
            
            ##########################################################################

            # Value between 0 and 1
            layer_data.opacity = layer.get('opacity')

            # "topdown" (default) or "index". objectgroup only.
            layer_data.draworder = layer.get('draworder')

             # 특정한 Layer을 MapData에 저장을 합니다.
            if layer_data.type == 'tilelayer':
                map_data.tile_layer = layer_data
            elif layer_data.name == 'Collision Layer':
                map_data.collision_layer = layer_data
            elif layer_data.name == 'Trigger Layer':
                map_data.trigger_layer = layer_data

            map_data.layers.append(layer_data)

        ##############################################################################

        # TILESET ####################################################################
        # Array of Tileset
        tilesets = data.get('tilesets')
        if tilesets is not None:
            for tileset in tilesets:

                tileset_data = TileSetData()

                # GID corresponding to the first tile in the set
                tileset_data.firstgid = tileset.get('firstgid')
                
                # Width of source image in pixels
                tileset_data.imagewidth = tileset.get('imagewidth')
                # Height of source image in pixels
                tileset_data.imageheight = tileset.get('imageheight')

                # Maximum width of tiles in this set
                tileset_data.tilewidth = tileset.get('tilewidth')
                # Maximum height of tiles in this set
                tileset_data.tileheight = tileset.get('tileheight')

                tileset_data.tilecount = tileset.get('tilecount')

                # Image used for tiles in this set
                image = tileset.get('image')
                if image is not None:
                    tileset_data.image = pico2d.load_image(image)

                    tileset_data.tilecols = tileset_data.imagewidth // tileset_data.tilewidth
                    tileset_data.tilerows = tileset_data.imageheight // tileset_data.tileheight

                # Name given to this tileset
                tileset_data.name = tileset.get('name')

                # Buffer between image edge and first tile (pixels)
                tileset_data.margin = tileset.get('margin')
                # Spacing between adjacent tiles in image (pixels)
                tileset_data.spacing = tileset.get('spacing')

                # Per-tile properties, indexed by gid as string
                tileset_data.tileproperties = tileset.get('tileproperties')

                # TERRAIN ############################################################
                # Array of Terrains (optional)
                terrains = tileset.get('terrain')
                if terrains is not None:
                    for terrain in terrains:
                        terrain_data = TerrainData()

                        # Name of terrain
                        terrain_data.name = terrain.get('name')

                        # Local ID of tile representing terrain
                        terrain_data.tile = terrain.get('tile')

                        tileset_data.terrains.append(terrain_data)

                ######################################################################

                # TILE ###############################################################
                # Gid-indexed Tiles (optional)
                tiles = tileset.get('tiles');
                if tiles is not None:
                    for i in range(tileset_data.tilecount):
                        tile_data = TileData()

                        # index of terrain for each corner of tile
                        #tile_data.terrain = tile.get('terrain')
                        
                        tileset_data.tiles.append(tile_data)

                ######################################################################
               
                map_data.tilesets.append(tileset_data)

        ##############################################################################

        return map_data