def enter(): global mario, map, enemy, object, fire_ball, chimney, mario_life global mario_life2, mario_life3, mario_life4 global item_box, brick, item, coin_box, turtle mario = Mario() map = Map() enemy = Enemy() object = Object() fire_ball = Ball() chimney = Chimney() mario_life = Mario_Life() mario_life2 = Mario_Life2() mario_life3 = Mario_Life3() mario_life4 = Mario_Life4() item_box = Object_Item() brick = Brick() item = Item() coin_box = Coin_Box() turtle = Turtle() game_world.add_object(map, 0) game_world.add_object(object, 1) game_world.add_object(mario, 0) game_world.add_object(enemy, 1) game_world.add_object(chimney, 0) game_world.add_object(mario_life, 1) game_world.add_object(mario_life2, 0) game_world.add_object(mario_life3, 1) game_world.add_object(mario_life4, 0) game_world.add_object(item_box, 1) game_world.add_object(brick, 0) game_world.add_object(coin_box, 1) game_world.add_object(turtle, 0) pass
def update(self): # 아이템상자 충돌체크 if self.is_collide_item_box: #self.is_jump = False pass # 점프 if self.is_jump: self.y = (2 * self.t**2 - 3 * self.t + 1) * self.y1 + ( -4 * self.t**2 + 4 * self.t) * self.y2 + (2 * self.t**2 - self.t) * self.y3 self.t += game_framework.frame_time if self.t >= 1: self.t = 0 self.is_jump = False # 벽돌 위 올라감 if self.is_collide_brick: brick = Brick() self.y = brick.y + 50 if self.x < brick.x - 50 or self.x > brick.x + 45: self.is_collide_brick = False if not self.is_collide_brick: self.y -= game_framework.frame_time * 100 # 굴뚝 위 올라감 if self.is_collide_chimney: chimney = Chimney() self.y = chimney.y + 120 if self.x < chimney.x - 30 or self.x > chimney.x + 10: self.is_collide_chimney = False if not self.is_collide_chimney: self.y -= game_framework.frame_time * 100 # 코인박스 위 올라감 if self.collide_coin_box: coin_box = Coin_Box() self.y = coin_box.y + 80 if self.x < coin_box.x - 20 or self.x > coin_box.x + 15: self.collide_coin_box = False if not self.collide_coin_box: self.y -= game_framework.frame_time * 100 self.cur_state.do(self) if len(self.event_que) > 0: event = self.event_que.pop() self.cur_state.exit(self, event) self.cur_state = next_state_table[self.cur_state][event] self.cur_state.enter(self, event) pass