示例#1
0
 def __init__(self, x, y, angle, GV):
     self.elem = element(GV, [coord(x, y)],
                         coord(x, y),
                         speed=coord(10 * math.cos(angle),
                                     -10 * math.sin(angle)),
                         collide=False)
     GV.obj_list.append(self)
示例#2
0
 def __init__(self, x1, y1, x2, y2, GV, color=(0, 0, 0)):
     self.draw_info = [x1, y1, x2 - x1, y2 - y1]
     self.elem = element(
         GV, [coord(x1, y1),
              coord(x2, y1),
              coord(x1, y2),
              coord(x2, y2)], coord(x1, y1))
     GV.obj_list.append(self)
     self.color = color
示例#3
0
    def getCoord(self):
        angle1 = utilitary.coord(self.elem.center.coord["x"] + self.size,
                                 self.elem.center.coord["y"])
        angle2 = utilitary.coord(self.elem.center.coord["x"] - self.size,
                                 self.elem.center.coord["y"])
        sommet = utilitary.coord(
            self.elem.center.coord["x"],
            int(self.elem.center.coord["y"] - 3 / 2 * self.size))

        return [angle1, angle2, sommet]
示例#4
0
 def __init__(self, x, y, GV, text):
     self.elem = element(GV, [coord(x + GV.size / 2, y - GV.size)],
                         coord(x + GV.size / 2, y - GV.size),
                         collide=False)
     GV.obj_list.append(self)
     self.size = GV.size
     self.point_list = [(x + GV.size / 3, y - GV.size * 3 / 4),
                        (x + GV.size * 2 / 3, y - GV.size * 3 / 4),
                        (x + GV.size * 3 / 4, y - 2 * GV.size),
                        (x + GV.size / 4, y - 2 * GV.size)]
     self.text = text
示例#5
0
 def getCoord(self):
     return [
         util.coord(self.elem.center.coord["x"] + 0.5 * self.size,
                    self.elem.center.coord["y"] + 1.6 * self.size),
         util.coord(self.elem.center.coord["x"] - 0.5 * self.size,
                    self.elem.center.coord["y"] + 1.6 * self.size),
         util.coord(self.elem.center.coord["x"] + 0.5 * self.size,
                    self.elem.center.coord["y"] - 2.3 * self.size),
         util.coord(self.elem.center.coord["x"] - 0.5 * self.size,
                    self.elem.center.coord["y"] - 2.3 * self.size)
     ]
示例#6
0
 def __init__(self,
              GV,
              points_list,
              coord,
              speed=coord(0, 0),
              accel=coord(0, 0),
              tempo=1,
              collide=True):
     self.center = physical_point(coord, speed, accel, tempo)
     self.points_list = points_list
     self.collide = collide
     GV.elem_list.append(self)
示例#7
0
 def __init__(self, x, y, GV):
     self.angle_cannon = 0
     self.size = GV.size / 2.5
     self.dead = False
     self.fire = 5
     self.elem = element(GV, [
         coord(x + self.size, y),
         coord(x + self.size, y - int(self.size * 3 / 2)),
         coord(x - self.size, y - int(self.size * 3 / 2)),
         coord(x - self.size, y)
     ], coord(x, y))
     GV.obj_list.append(self)
示例#8
0
 def __init__(self, x, y, size, GV):
     h = size / 15
     self.color = color = (0, 200, 0)
     self.point_list = [[x + size - h, y], [x + size - h, y - size * 3 / 2],
                        [x, y - size * 7 / 4 + h / 2],
                        [x + size - h, y - size * 2 + h],
                        [x + size - h, y - size * 2],
                        [x + size, y - size * 2], [x + size, y]]
     self.elem = element(
         GV,
         [coord(x, y),
          coord(x + size, y),
          coord(x + size, y + 2 * size)], coord(x,
                                                y + 2 * size), coord(x, y))
     GV.obj_list.append(self)
示例#9
0
    def __init__(self, x1, y, number, size, GV):
        self.point_list = []
        for i in range(0, number, 1):
            self.point_list.append([x1 + i * size, y])
            self.point_list.append([x1 + i * size + size / 2, y - size])
            self.color = (200, 0, 0)

        self.elem = element(GV, [
            coord(x1, y),
            coord(x1 + number * size, y),
            coord(x1 + number * size, y - size * 3 / 4),
            coord(x1, y - size * 3 / 4)
        ], coord(x1, y))

        self.point_list.append([x1 + number * size, y])
        GV.obj_list.append(self)
示例#10
0
    def __init__(self, x, y, GV):
        self.angle_body = math.pi / 2
        self.angle_l_arm = -2 * math.pi / 3
        self.angle_r_arm = -math.pi / 3
        self.angle_l_leg = -2 * math.pi / 3
        self.angle_r_leg = -math.pi / 3
        self.angle_l_knee = -math.pi / 16 * 9
        self.angle_r_knee = -math.pi / 16 * 7
        self.size = GV.size / 2.5
        self.health = 9
        self.energy = 1
        self.elem = physics.element(GV,
                                    None,
                                    util.coord(x, y),
                                    accel=util.coord(0, 1))
        self.isAlive = True
        self.is_grounded = False
        self.on_wall = False
        GV.obj_list.append(self)

        self.running = False
        self.jumping = False
示例#11
0
 def __init__(self, x, y, size, GV):
     self.elem = element(GV, [coord(x + size / 2, y - size)],
                         coord(x + size / 2, y - size),
                         collide=False)
     GV.obj_list.append(self)
     self.size = size