def shoot_data(self, x, y, hspeed, vspeed): datafragment = DataFragment(x, y, self.fragmentWidth, self.fragmentHeight, ASSET.dataFragment) datafragment.collision_group = self.player1.collision_group.copy() datafragment.collision_group = self.player2.collision_group.copy() self.player1.movingforce_group.add(datafragment) self.player2.movingforce_group.add(datafragment) self.display_group.add(datafragment) self.datafragment_group.add(datafragment) datafragment.killer_group = self.enemy_group.copy() datafragment.storage_group.add(self.portals_group) datafragment.collision_group.add(self.dataspawner_group) datafragment.killer_group.add(self.saw_group) datafragment.hspeed = hspeed datafragment.vspeed = vspeed
def spawn_data(self): speed = 0 x = 0 y = 0 for spawner in self.dataspawner_group: x = spawner.rect.x + spawner.rect.width/2 y = spawner.rect.y + spawner.rect.height speed = spawner.hspeed datafragment = DataFragment(x, y, self.fragmentWidth, self.fragmentHeight, ASSET.dataFragment) datafragment.hspeed = speed datafragment.collision_group = self.player1.collision_group.copy() datafragment.collision_group = self.player2.collision_group.copy() self.player1.movingforce_group.add(datafragment) self.player2.movingforce_group.add(datafragment) self.display_group.add(datafragment) self.datafragment_group.add(datafragment) datafragment.killer_group = self.enemy_group.copy() datafragment.storage_group.add(self.portals_group) datafragment.collision_group.add(self.dataspawner_group) datafragment.killer_group.add(self.saw_group)