def restart(self): """Reset all the games variables causing a restart.""" for _, sprite_group in self._entities.items(): sprite_group.empty() self._tank = Factory.create_tank(self._entities['all'], self._entities['tanks']) self._shields = Factory.create_shields(self._entities['all'], self._entities['shields']) self._alien_horde = Factory.create_horde(self._entities['all'], self._entities['ships'])