def get_tile(self): selected = None sel_top = 0 _, foot, _, _ = self.get_bb() x, y = self.draw_pos for tile in gfw.world.objects_at(gfw.layer.tile): if tile.name in [ 'entrance', 'exit', 'ledder_bottom', 'ledder_top', 'rope_top', 'rope_mid', 'rope_last' ]: continue l, b, r, t = tile.get_bb() if x < l - 10 or x > r + 10: continue gab = (b + t) // 2 + 20 if foot < gab: continue if selected is None: selected = tile sel_top = t else: if t > sel_top: selected = tile sel_top = t # if selected is not None: # print(l,b,r,t, selected) return selected
def tile_check(self, tile): _, foot, _, _ = self.get_bb() l, b, r, t = tile.get_bb() dy = 0 if foot > t: self.dy -= GRAVITY * gfw.delta_time # 중력 적용 else: # print('falling', t, foot) if self.dy <= 0 and int(foot) < t: dy = t - foot self.dy = 0 self.dx = 0 # print('Now running', t, foot) return dy
def get_wall(self): selected = None _, y = self.draw_pos left, _, right, _ = self.get_bb() for tile in gfw.world.objects_at(gfw.layer.tile): if tile.name in [ 'entrance', 'exit', 'ledder_bottom', 'ledder_top' ]: continue l, b, r, t = tile.get_bb() if y > t or y < b: continue if right < l or left > r: continue selected = tile return selected
def get_floor(self): x, y = self.draw_pos _, _, _, P_top = self.get_bb() for tile in gfw.world.objects_at(gfw.layer.tile): if tile.name in [ 'entrance', 'exit', 'ledder_bottom', 'ledder_top' ]: continue l, b, r, t = tile.get_bb() if x > r + 10 or x < l - 10: continue gab = (b + t) // 2 if y > gab: continue if P_top < b: pass else: if self.dy > 0: self.dy = 0