# air object template - used for most air objects import random import pygame from pygame.locals import * import game, gfx from basespriteobj import * class AirObj(Sprite): """Note- if you do not provide image, you must set the self.rect, self.lastrect, self.x and self.y values yourself!""" type = AIR_OBJECT def __init__(self,name,image): Sprite.__init__(self) self.name = name self.pointvalue = game.point_tbl[self.name] self.collision_timer = game.collision_timer if image != None: self.image = image self.rect = self.image.get_rect() self.lastrect = self.rect self.x,self.y = list(self.rect.topleft) self.x = gfx.rect.right + 1 self.y = random.randrange(game.arena.top,game.arena.bottom-self.rect.height) self.dx = -game.groundspeed self.dy = 0 self.objective = 0 self.exploding = 0 def tick(self, speedadjust): self.x += self.dx * speedadjust if self.x < 0 - self.rect.width: self.dead = 1 self.rect.topleft = [self.x,self.y]