def updateBullet(self, bullet): if not ObjectFactory.updateBullet(bullet): newBullet = BulletFactory.getInstance(bullet) newBullet.rotation = bullet.get('rotation') newBullet.do(MoveBy(bullet.get('moveTo'), 1)) LayoutFactory.addBullet(newBullet) ObjectFactory.addBullet(newBullet)
def updateObject(self, object): id = object.get(NetworkDataCodes.OBJECT_ID) position = object.get(NetworkDataCodes.POSITION) rotation = object.get(NetworkDataCodes.ROTATION) clan = object.get(NetworkDataCodes.CLAN) ObjectFactory.getOrCreate(id=id, position=position, rotation=rotation, clan=clan)
def updateTank(self, tank): fraction = tank.get('fraction') if not ObjectFactory.updateTank(tank): movingHandler = MovingHandlersFactory.getInstance(fraction) newTank = TankFactory.getInstance(tank) newTank.do(movingHandler()) LayoutFactory.addTank(newTank, fraction) ObjectFactory.addTank(newTank, fraction)
def tanks(self): if self.arguments.get('tanks'): for tank in self.arguments.get('tanks'): fraction = tank.get('fraction') type = tank.get('type') movingHandler = MovingHandlersFactory.getInstance(fraction) Tank = TankFactory.getInstance(type) Tank.do(movingHandler()) Tank.position = (tank.get('x'), tank.get('y')) #settings.collision_manager.add(Tank1) LayoutFactory.addTank(Tank, fraction) ObjectFactory.addTank(Tank, fraction)