示例#1
0
    def reset(self):
        self.foes.clear()
        self.goals.clear()

        for i in xrange(self.n_foes):
            self.foes.add(Foe(batma.Vector2(200, 200)))

        for i in xrange(self.n_goals):
            self.goals.append(Goal())
示例#2
0
    def __init__(self,
                 total_particles=200,
                 image=None,
                 duration=-1.0,
                 gravity=None,
                 pos_var=None,
                 origin=None,
                 angle=90.0,
                 angle_var=360.0,
                 speed=60.0,
                 speed_var=10.0,
                 tangential_accel=80.0,
                 tangential_accel_var=0.0,
                 radial_accel=-80.0,
                 radial_accel_var=0.0,
                 size=37.0,
                 size_var=10.0,
                 life=4.0,
                 life_var=1.0,
                 start_color=None,
                 start_color_var=None,
                 end_color=None,
                 end_color_var=None,
                 emission_rate=None,
                 blend_additive=True,
                 position_type=POSITION_GROUPED):

        gravity = gravity or batma.Vector2(0, 0)
        pos_var = pos_var or batma.Vector2(0, 0)

        start_color = start_color or batma.Color(0.12, 0.25, 0.76, 1.0)
        start_color_var = start_color_var or batma.Color(0.0, 0.0, 0.0, 0.0)
        end_color = end_color or batma.Color(0.0, 0.0, 0.0, 0.0)
        end_color_var = end_color_var or batma.Color(0.0, 0.0, 0.0, 0.0)
        emission_rate = emission_rate or total_particles / life

        super(Galaxy,
              self).__init__(total_particles, image, duration, gravity,
                             pos_var, origin, angle, angle_var, speed,
                             speed_var, tangential_accel, tangential_accel_var,
                             radial_accel, radial_accel_var, size, size_var,
                             life, life_var, start_color, start_color_var,
                             end_color, end_color_var, emission_rate,
                             blend_additive, position_type)
示例#3
0
    def __init__(self,
                 total_particles=7000,
                 image=None,
                 duration=0.1,
                 gravity=None,
                 pos_var=None,
                 origin=None,
                 angle=90.0,
                 angle_var=360.0,
                 speed=70.0,
                 speed_var=40.0,
                 tangential_accel=0.0,
                 tangential_accel_var=0.0,
                 radial_accel=0.0,
                 radial_accel_var=0.0,
                 size=15.0,
                 size_var=10.0,
                 life=5.0,
                 life_var=2.0,
                 start_color=None,
                 start_color_var=None,
                 end_color=None,
                 end_color_var=None,
                 emission_rate=None,
                 blend_additive=False,
                 position_type=POSITION_GROUPED):

        gravity = gravity if gravity is not None else batma.Vector2(0, -90)
        pos_var = pos_var or batma.Vector2(0, 0)
        start_color = start_color or batma.Color(0.7, 0.2, 0.1, 1.0)
        start_color_var = start_color_var or batma.Color(0.5, 0.5, 0.5, 0.0)
        end_color = end_color or batma.Color(0.5, 0.5, 0.5, 0.0)
        end_color_var = end_color_var or batma.Color(0.5, 0.5, 0.5, 0.0)
        emission_rate = emission_rate or total_particles / life

        super(Explosion,
              self).__init__(total_particles, image, duration, gravity,
                             pos_var, origin, angle, angle_var, speed,
                             speed_var, tangential_accel, tangential_accel_var,
                             radial_accel, radial_accel_var, size, size_var,
                             life, life_var, start_color, start_color_var,
                             end_color, end_color_var, emission_rate,
                             blend_additive, position_type)
示例#4
0
    def __init__(self,
                 total_particles=3000,
                 image=None,
                 duration=-1.0,
                 gravity=None,
                 pos_var=None,
                 origin=None,
                 angle=90,
                 angle_var=20,
                 speed=180,
                 speed_var=50,
                 tangential_accel=0.0,
                 tangential_accel_var=0.0,
                 radial_accel=0.0,
                 radial_accel_var=0.0,
                 size=8.0,
                 size_var=2.0,
                 life=3.5,
                 life_var=1.0,
                 start_color=None,
                 start_color_var=None,
                 end_color=None,
                 end_color_var=None,
                 emission_rate=None,
                 blend_additive=False,
                 position_type=POSITION_GROUPED):

        gravity = gravity or batma.Vector2(0, -90)
        pos_var = pos_var or batma.Vector2(0, 0)
        start_color = start_color or batma.Color(0.5, 0.5, 0.5, 1.0)
        start_color_var = start_color_var or batma.Color(0.5, 0.5, 0.5, 1.0)
        end_color = end_color or batma.Color(0.1, 0.1, 0.1, 0.2)
        end_color_var = end_color_var or batma.Color(0.1, 0.1, 0.1, 0.2)
        emission_rate = emission_rate or total_particles / life

        super(Firework,
              self).__init__(total_particles, image, duration, gravity,
                             pos_var, origin, angle, angle_var, speed,
                             speed_var, tangential_accel, tangential_accel_var,
                             radial_accel, radial_accel_var, size, size_var,
                             life, life_var, start_color, start_color_var,
                             end_color, end_color_var, emission_rate,
                             blend_additive, position_type)
示例#5
0
文件: camera.py 项目: a100q100/batma
 def get_center(self):
     return batma.Vector2(self.__center_x, self.__center_y)
示例#6
0
文件: util.py 项目: a100q100/batma
def random_position(offset_x=0, offset_y=0):
    return batma.Vector2(
        random.randint(offset_x, batma.display.width - offset_x),
        random.randint(offset_y, batma.display.height - offset_y),
    )
示例#7
0
 def get_center(self):
     return batma.Vector2(self.x, self.y)
示例#8
0
 def copy(self):
     return CircleCollider(batma.Vector2(*self.center), self.radius)
示例#9
0
 def copy(self):
     return BoxCollider(batma.Vector2(*self.center), self.half_width,
                        self.half_height)
示例#10
0
 def get_size(self):
     return batma.Vector2(self.width, self.height)