Beispiel #1
0
 def __init__(self):
     Sprite.__init__(self)
     self.speed = 0.27
     self.decay = 0.98
     self.pos = Point(350, 200)
     self.time_to_respawn = 0
     self.init_shape()
Beispiel #2
0
 def __init__(self):
     Sprite.__init__(self)
     self.speed = 0.27
     self.decay = 0.98
     self.pos = Point(350, 200)
     self.time_to_respawn = 0
     self.init_shape()
Beispiel #3
0
 def __init__(self, size=Large):
     Sprite.__init__(self)
     self.theta_vel = 0.0
     self.speed = 0.35
     self.size = size
     self.init_shape()
     self.init_motion()
     self.init_edge()
Beispiel #4
0
 def __init__(self, bounds):
     Sprite.__init__(self)
     self.pos.x = randint(bounds.pos.x, bounds.pos.x + bounds.size.width - 1)
     self.pos.y = randint(bounds.pos.y, bounds.pos.y + bounds.size.height - 1)
     self.color = [255, 255, 255]
     self.fade = 10
     self.time_to_fade = randint(25, 250)
     self.init_shape()
Beispiel #5
0
 def __init__(self, size=Large):
     Sprite.__init__(self)
     self.theta_vel = 0.0
     self.speed = 0.35
     self.size = size
     self.init_shape()
     self.init_motion()
     self.init_edge()
Beispiel #6
0
 def __init__(self, x, y, theta):
     Sprite.__init__(self)
     self.pos.x = x
     self.pos.y = y
     self.theta = theta
     self.vel.x = math.sin(theta) * 10.0
     self.vel.y = -math.cos(theta) * 10.0
     self.time_to_live = 30
     self.from_ship = False
     self.init_shape()
Beispiel #7
0
 def __init__(self, size=Large):
     Sprite.__init__(self)
     self.size = size
     self.wrap.x = False
     self.speed = 2.0
     self.time_to_fire = 30
     self.time_to_deviate = 0
     self.init_shape()
     self.init_edge()
     self.reset_deviation()
Beispiel #8
0
 def __init__(self, size = Large):
     Sprite.__init__(self)
     self.size = size
     self.wrap.x = False
     self.speed = 2.0
     self.time_to_fire = 30
     self.time_to_deviate = 0
     self.init_shape()
     self.init_edge()
     self.reset_deviation()
Beispiel #9
0
 def __init__(self, x, y, theta):
     Sprite.__init__(self)
     self.pos.x = x
     self.pos.y = y
     self.theta = theta
     self.vel.x = math.sin(theta) * 10.0
     self.vel.y = -math.cos(theta) * 10.0
     self.time_to_live = 30
     self.from_ship = False
     self.init_shape()
Beispiel #10
0
 def __init__(self, bounds):
     Sprite.__init__(self)
     self.pos.x = randint(bounds.pos.x,
                          bounds.pos.x + bounds.size.width - 1)
     self.pos.y = randint(bounds.pos.y,
                          bounds.pos.y + bounds.size.height - 1)
     self.color = [255, 255, 255]
     self.fade = 10
     self.time_to_fade = randint(25, 250)
     self.init_shape()
Beispiel #11
0
 def update(self):
         
     Sprite.update(self)
     if self.pos.x < self.orig[6].x or self.pos.x > ScreenSize.width + self.orig[3].x:
         self.alive = False
 
     self.time_to_deviate -=1
     if self.time_to_deviate <= 0:
         self.deviate_course()
         self.reset_deviation()    
     self.time_to_fire -= 1
Beispiel #12
0
 def update(self):
     
     Sprite.update(self)
     self.vel.x *= self.decay
     self.vel.y *= self.decay
     
     # Countdown to respawn
     if self.time_to_respawn > 0:
         self.time_to_respawn -= 1
         if self.time_to_respawn == 0:
             self.alive = True
Beispiel #13
0
    def update(self):

        Sprite.update(self)
        self.vel.x *= self.decay
        self.vel.y *= self.decay

        # Countdown to respawn
        if self.time_to_respawn > 0:
            self.time_to_respawn -= 1
            if self.time_to_respawn == 0:
                self.alive = True
Beispiel #14
0
    def update(self):

        Sprite.update(self)
        if self.pos.x < self.orig[
                6].x or self.pos.x > ScreenSize.width + self.orig[3].x:
            self.alive = False

        self.time_to_deviate -= 1
        if self.time_to_deviate <= 0:
            self.deviate_course()
            self.reset_deviation()
        self.time_to_fire -= 1
Beispiel #15
0
    def update(self):

        Sprite.update(self)

        if self.time_to_fade:
            self.time_to_fade -= 1
        else:
            self.color = [col - self.fade for col in self.color]
            if self.color[0] >= 255:
                self.time_to_fade = randint(25, 250)
                self.color = [255, 255, 255]
                self.fade *= -1
            elif self.color[0] <= 0:
                self.color = [0, 0, 0]
                self.fade *= -1
Beispiel #16
0
 def update(self):
     
     Sprite.update(self)
     
     if self.time_to_fade:
         self.time_to_fade -= 1
     else:
         self.color = [col - self.fade for col in self.color]
         if self.color[0] >= 255:
             self.time_to_fade = randint(25, 250)
             self.color = [255, 255, 255]
             self.fade *= -1
         elif self.color[0] <= 0:
             self.color = [0, 0, 0]
             self.fade *= -1
Beispiel #17
0
 def update(self):
     Sprite.update(self)
     self.time_to_live -= 1
     if self.time_to_live <= 0:
         self.alive = False
Beispiel #18
0
 def update(self):
     Sprite.update(self)
     self.time_to_live -= 1
     if self.time_to_live <= 0:
         self.alive = False
Beispiel #19
0
 def render(self, gfx, color=[255, 255, 255]):
     Sprite.render(self, gfx)
     pygame.draw.aaline(gfx, color, (self.pts[2].x, self.pts[2].y),
                        (self.pts[7].x, self.pts[7].y), 1)
     pygame.draw.aaline(gfx, color, (self.pts[3].x, self.pts[3].y),
                        (self.pts[6].x, self.pts[6].y), 1)
Beispiel #20
0
 def render(self, gfx, color = [255, 255, 255]):
     Sprite.render(self, gfx)
     pygame.draw.aaline(gfx, color, (self.pts[2].x, self.pts[2].y), (self.pts[7].x, self.pts[7].y), 1)
     pygame.draw.aaline(gfx, color, (self.pts[3].x, self.pts[3].y), (self.pts[6].x, self.pts[6].y), 1)
Beispiel #21
0
 def render(self, gfx):
     if self.alive:
         Sprite.render(self, gfx, self.color)
Beispiel #22
0
 def render(self, gfx):
     if self.alive:
         Sprite.render(self, gfx, self.color)