def init_space(): sp = Space() h = 20 * sqrt(2) player = Body(mass=1, moment=400) shape = Poly(player, [(-20, -h / 3), (20, -h / 3), (0, 2 / 3 * h)]) player.position = (90, 90) shape.elasticity = 1.0 shape.color = pyxel.COLOR_YELLOW line = Body(body_type=Body.STATIC) lines = [ Segment(line, (0, 1), (240, 1), 2), Segment(line, (0, 179), (240, 179), 2), Segment(line, (1, 0), (1, 180), 2), Segment(line, (239, 0), (239, 180), 2), ] for line in lines: line.elasticity = 1.0 line.color = pyxel.COLOR_PEACH sp.add(player, shape, *lines) sp.player = player return sp