示例#1
0
    def __init__(self, image_surface, pivot=None, uuid=0):
        super(RenderableObject, self).__init__(uuid)

        img_width = image_surface.get_width()
        img_height = image_surface.get_height()

        # Set up pivot for the image
        pivot = Vector2(img_width / 2, img_height /
                        2) if pivot is None else Vector2(0, 0)

        self.transform = Transform(Vector2(0, 0))
        self.renderer = Renderer(image_surface, pivot)

        self.add_component(self.transform)
        self.add_component(self.renderer)
示例#2
0
    def __init__(self, image_surface, uuid=0):
        super(GameObject, self).__init__(uuid)

        img_width = image_surface.get_width()
        img_height = image_surface.get_height()

        # Set up pivot for the image
        pivot = Vector2(img_width / 2, img_height / 2)

        self.transform = Transform(Vector2(0, 0))
        self.renderer = Renderer(image_surface, pivot)
        self.collider = components.BoxCollider(img_width, img_height)

        self.add_component(self.transform)
        self.add_component(self.renderer)
        self.add_component(self.collider)
示例#3
0
    def __init__(self, width, height, uuid=0):
        super(BoxColliderObject, self).__init__(uuid)

        self.transform = Transform(Vector2(0, 0))
        self.collider = components.BoxCollider(width, height)

        self.add_component(self.transform)
        self.add_component(self.collider)
示例#4
0
def set_box_attributes(box):
    box.renderer.depth = 2
    box.collider.restitution = 0
    box.collider.surface_friction = 0.8
    box.collider.box.w -= 10
    box.collider.box.h -= 10

    box.add_component(RigidBody())
    box.rigid_body.velocity = Vector2(0.0, 0.0)
    box.rigid_body.gravity_scale = 2.0
    box.tag = "box"
示例#5
0
 def __init__(self, image_surface=None, pos=Vector2(0, 0)):
     self.uuid = 0
     self.position = pos
     self.image = image_surface
     self.tag = ""