Exemple #1
0
	def __init__( self, lives, score, bulletMan, maxSpeed, sprite, viewBox, bulletSprite, bulletBox ):
		# position vars
		self.SPAWN_X = 300
		self.SPAWN_Y = 600
		self.xpos = self.SPAWN_X
		self.ypos = self.SPAWN_Y
		Entity.__init__( self, 400 , 300, sprite, Rect( self.xpos - 10,
							self.ypos - 10, self.xpos + 54, self.ypos + 54 ) )

		# movement vars
		self._maxSpeed = maxSpeed
		self._focusedSpeed = maxSpeed /  2.0
		self._xSpeed = 0
		self._ySpeed = 0

		# Game vars
		self.lives = lives
		self.score = score
		self.invincible = False
		self._invincibilityTime = 5000
		self._bulletMan = bulletMan
		self._FIRE_COOL_MAX = 10
		self._fireCoolDown = 0

		# sprite vars
		self._itemBox = Rect( self.xpos, self.ypos, self.xpos + 64,
									self.ypos + 64 )
		self._viewBox = viewBox
		self._bulletSprite = bulletSprite
		self._bulletBox = bulletBox
Exemple #2
0
    def __init__(self, pos=(0, 0), zoom=0.25):
        #possible inheritance fail
        Vec2.__init__(self, pos[0], pos[1])
        Entity.__init__(self)

        self.zoom = zoom
        self.shift = Vec2(0, 0)
Exemple #3
0
    def __init__(self, board, speed, initialSize, initialHeadPos, initialDir, priority=0, initialComponents=None):
        Entity.__init__(self, priority, initialComponents)
        self._board = board
        self._headPos = initialHeadPos
        self._dir = initialDir
        self._deque = deque()
        for i in range(initialSize):
            self._deque.appendleft(initialHeadPos - initialDir * i)

        self._speed = speed
        self._passedDistance = 0.0
        self._dirQueue = deque()
        self._ateFood = False
        self.onFoodEaten = EventHook()
        self.onDeath = EventHook()
Exemple #4
0
	def __init__( self, xpos, ypos, speed, hp, sprite, hitbox ):
		Entity.__init__( self, xpos, ypos, sprite, hitbox )
		# movement vars
		self._speedx = 0
		self._speedy = 0
		self._curAngle = 270
		#self._maxspeed = speed
		self._maxspeed = 2

		# game vars
		self.destroyed = False
		self.hit = False
		self.hp = hp
		self.heat = 0
		self._actcode = 0

		self._hitbox.move_ip( xpos, ypos )
Exemple #5
0
	def __init__ ( self, xpos, ypos, speed, damageValue, sprite, hitbox ):
		Entity.__init__( self, xpos, ypos, sprite, hitbox )
		self._speed = speed
		self.damageValue = damageValue
		self.destroyed = False
Exemple #6
0
 def __init__(self, board, pos, type, priority=0, initialComponents=None):
     Entity.__init__(self, priority, initialComponents)
     self._board = weakref.ref(board)
     self._pos = pos
     self._type = type
     self.food = None
Exemple #7
0
 def __init__(self, board, pos, priority=0, initialComponents=None):
     Entity.__init__(self, priority, initialComponents)
     self._board = board
     self._pos = pos
     self.setPos(self._pos)
     self._board.getCell(self._pos.x, self._pos.y).food = self
Exemple #8
0
 def __init__(self, cellMatrix, priority=0, initialComponents=None):
     Entity.__init__(self, priority, initialComponents)
     self._cellMatrix = cellMatrix
     self._rows = len(self._cellMatrix)
     self._cols = len(self._cellMatrix[0])
     self._cells = list()