Пример #1
0
    def __init__(self, position, level):

        PhysicalObject.__init__(self, position)

        self.level = level
        self.controllingPlayer = physical_object.OWNER_DEFENDER

        self.physicsRect = pygame.rect.Rect(self.r_x, self.r_y, TURRET_WIDTH, TURRET_HEIGHT)

        self.image = pygame.image.load("images/defenses.png")
        self.rect = self.image.get_rect()

        self.actions = {
            "charged 0": (0, 112, TURRET_WIDTH, TURRET_HEIGHT),
            "charged 50": (TURRET_WIDTH, 112, TURRET_WIDTH, TURRET_HEIGHT),
            "charged 100": (2 * TURRET_WIDTH, 112, TURRET_WIDTH, TURRET_HEIGHT),
        }

        self.boundsRect = Rect(level.rect.x, level.rect.y, level.rect.width, constants.SCREEN_HEIGHT)

        self.action = "charged 0"
        self.area = pygame.rect.Rect(self.actions[self.action])
        # print 'turret (x,y) = ', (self.r_x, self.r_y)
        # print 'turret owner = ', self.controllingPlayer

        self.timeLeftToCharge = GUN_CHARGEUP_TIME
Пример #2
0
	def __init__(self, position, bulletkind):
		
		PhysicalObject.__init__(self, position)

		self.collisionType = physical_object.COLLISION_TYPE_BULLET
		self.physicsRect = pygame.rect.Rect(self.r_x, self.r_y, BULLET_WIDTH, BULLET_HEIGHT)

		self.image = pygame.image.load('images/bullets.png')
		self.rect = self.image.get_rect()

		self.kinds = {"shp": (0, 0, self.physicsRect.width, self.physicsRect.height),
			      "tur": (12, 0, self.physicsRect.width, self.physicsRect.height)}

		self.kind = bulletkind
		self.area = pygame.rect.Rect(self.kinds[self.kind])

		self.timeToLive = LIFE_SPAN
Пример #3
0
	def __init__(self, position, level):

		PhysicalObject.__init__(self, position)
		self.level = level

		self.controllingPlayer = physical_object.OWNER_ATTACKER

		self.image = pygame.image.load('images/ship.png')
		self.rect = self.image.get_rect()

		self.actions = {	"center":	(SHIP_WIDTH*2, 0, SHIP_WIDTH,SHIP_HEIGHT),
			"left":	 (SHIP_WIDTH*0, 0, SHIP_WIDTH,SHIP_HEIGHT),
			"left-center":	(SHIP_WIDTH*1, 0, SHIP_WIDTH,SHIP_HEIGHT),
			"right-center":	(SHIP_WIDTH*3, 0, SHIP_WIDTH,SHIP_HEIGHT),
			"right":	(SHIP_WIDTH*4, 0, SHIP_WIDTH,SHIP_HEIGHT)
			}

		self.action = "center"
		self.area = pygame.rect.Rect(self.actions[self.action])

		self.boundsRect = Rect(level.rect.x,level.rect.y,level.rect.width,constants.SCREEN_HEIGHT)

		self.physicsRect = pygame.rect.Rect(self.r_x, self.r_y, SHIP_WIDTH, SHIP_HEIGHT)
		self.targetType = physical_object.TARGET_TYPE_SHIP