Esempio n. 1
0
 def update(self, delta):
     self.time -= delta
     if self.time > 0:
         return
     riged = self.gameObject.riged
     if riged:
         center = self.gameObject.shape.Center()
         world = self.gameObject.world
         radius = self.gameObject.shape.Radius()
         
         bdir = riged.velocity.normalize()
         if bdir.magnitude() == 0:
             bdir = self.catche
         self.catche = bdir
     
         (left, mid, right) = pygame.mouse.get_pressed()
         if left:
             self.gs.play()
             spos = center.add(bdir.scale(radius))
             bdir = bdir.scale(500)
             Attacks.createBullet(self.gameObject,world, spos.x, spos.y-24, bdir.x, bdir.y, 5,damage=10, time = 2, ignores={'GameObject':[self.gameObject]},file_name='Resources/sprites/bullet.txt')
             self.time = .25
         if right:
             self.ss.play()
             spos = center
             Attacks.createExplosion(self.gameObject, world, spos.x, spos.y, 40, damage = 10, time = .25, ignores={'GameObject':[self.gameObject]}, file_name='Resources/sprites/explosion1.txt')
             self.time = .5
             pass
         if mid:
             pass
Esempio n. 2
0
 def doAttackRange(self,arg):
     world = self.gameObject.world
     pos = self.gameObject.shape.Center()
     if arg.has_key('target'):
         target = arg['target']
         bdir = target.sub( pos).scale(.25)
         pos = pos.add(bdir)
     
     Attacks.createExplosion(self.gameObject, world, pos.x, pos.y, 40, damage = self.rangeDamage,  time= .25,
                              ignores={'type':[self.gameObject.type]}, nockback = 0, file_name='Resources/sprites/explosion1.txt')