def __init__(self, animations):
     GameObject.__init__(self, animations)
     self.type.append('hittable')
     self.hitboxes = [Rectangle(self, Coordinates(0, 0), 50, 50)]
     self.priority = 80
     self.walking_distance = Coordinates(600, 600)
     self.additional_firing_coordinates = Coordinates(0, 0)
 def __init__(self, animations, velocity=Vector(0, 0), center_of_gravity=Coordinates(0, 0), mass=0.02):
     GameObject.__init__(self, animations)
     self.velocity = velocity
     self.mass = mass
     self.hit_exceptions = []
     self.type_exceptions = ['shootable']
     self.center_of_gravity = center_of_gravity
     self.thread = Thread(self.run, (), 'projectile thread')
示例#3
0
 def __init__(self):
     GameObject.__init__(self, [StaticAnimation(self, 'resources\\test_images\\spawn.png')])
     self.character = 'Kirito'
     self.type.append('writable')
     self.type.append('spawn')
     self.priority = 10
     self.width = 50
     self.height = 50
示例#4
0
        line2 = Line(
            self.gameobject,
            self.get_coordinates() - v * self.radius,
            self.get_coordinates() - v * self.radius + additional_coordinates)
        line3 = Line(
            self.gameobject,
            self.get_coordinates() - v * self.radius + additional_coordinates,
            self.get_coordinates() + v * self.radius + additional_coordinates)
        line4 = Line(
            self.gameobject,
            self.get_coordinates() + v * self.radius + additional_coordinates,
            self.get_coordinates() + v * self.radius)
        return [
            self, circle2,
            MultilineObject(self.gameobject, self.coordinates,
                            [line1, line2, line3, line4])
        ]


if __name__ == '__main__':
    from objects.game_object.game_object import GameObject
    from physics.coordinates import Coordinates
    from objects.game_object.hitboxes.line import Line

    g = GameObject([])
    g.coordinates = Coordinates(5, 0)
    c = Circle(g, Coordinates(1, 0), 5)
    l = Line(g, Coordinates(2, 0), Coordinates(2, 0))

    print(c.get_intersections(l))
示例#5
0
 def __init__(self, path):
     GameObject.__init__(self, [StaticAnimation(self, path)])
     self.type.append('fixed')
     self.type.append('unstretchable')
     self.coordinates = Coordinates(0, 0)
     self.priority = 0
示例#6
0
 def __init__(self, animations, mass):
     GameObject.__init__(self, animations)
     self.type.append('gravity field')
     self.mass = mass
     self.center_of_gravity = Coordinates(0, 0)
 def __init__(self, animations):
     GameObject.__init__(self, animations)
     self.type.append('hittable')
     self.type.append('writable')
 def __init__(self):
     GameObject.__init__(self, [StaticAnimation(self, 'resources\\test_images\\red.png'), Coordinates(5, 5)])
     self.priority = 100
     self.width = 5
     self.height = 5