Exemplo n.º 1
0
 def drawHp(self):
     self.health = []
     hpcount = self.game.player.hp
     for i in range(0,hpcount):
         heart = QGraphicsPixmapItem(self.heart)
         heart.setY(660)
         heart.setX(20+i*50)
         self.scene.addItem(heart)
         self.health.append(heart)
Exemplo n.º 2
0
 def drawProjectiles(self):
     for projectile in self.game.projectiles:
         if projectile.shape == None:
             if projectile.ptype == 1:
                 shape = QGraphicsPixmapItem(self.arrow)
             elif projectile.ptype == 2:
                 shape = QGraphicsEllipseItem(0,0,5,5)
                 shape.setBrush(QColor(0,0,0))
             shape.setX(projectile.x)
             shape.setY(projectile.y)
             self.scene.addItem(shape)
             projectile.shape = shape
         projectile.shape.setX(projectile.x)
         projectile.shape.setY(projectile.y)
         if projectile.ptype == 1:
             projectile.shape.setRotation(projectile.rotation)
         if projectile.shape.collidesWithItem(projectile.enemy.shape):
             projectile.enemy.getHit(projectile.damage)
             self.scene.removeItem(projectile.shape)
             self.game.projectiles.remove(projectile)
         self.update()