def getInstance(bullet): new_bullet = None if bullet.get('typeClass') == 'StandartBullet': new_bullet = StandartBullet() new_bullet.position = bullet.get('position') new_bullet.id = bullet.get('id') return new_bullet
def fire(self): if self.canFire: self.canFire = False x, y = self.Gun.position bullet = StandartBullet() bullet.update_rotation(self.Gun.rotation) bullet.update_position(x, y) settings.objects['bullets'].append(bullet) settings.layers['bullets'].add(bullet) t = Timer(self.bulletFreezTime, self.acceptFire) t.start()
def fire(self): if self.canFire: self.canFire = False x, y = self.Gun.position bullet = StandartBullet() bullet.update_rotation(self.Gun.rotation) bullet.update_position(x, y) settings.TankNetworkListenerConnection.Send({ 'action': settings.Actions.TANK_FIRE, 'type': 'StandartBullet', 'pos': bullet.position, 'rotation': bullet.rotation, 'id': self.id }) #settings.objects['bullets'].append(bullet) #settings.layers['bullets'].add(bullet) t = Timer(self.bulletFreezTime, self.acceptFire) t.start()