def init_elements(self): self.view_port = ViewPort() self.controller = UserController() self.resource = Resources() self.sprite_group = IGroup() self.explosion_group = IGroup() self.map = Map() main_sprite = Qie(self) main_sprite.pos = np.random.randint(-100, 100, size=(1, 2)) self.sprite_group.add(main_sprite) main_sprite.attack_range = 2000 insect = Insect(self) insect.pos = np.random.randint(-100, 100, size=(1, 2)) insect.speed = 1 insect.target = main_sprite self.sprite_group.add(insect) exp = BombExplosion(self) exp.pos = np.random.randint(-100, 100, size=(1, 2)) self.explosion_group.add(exp) exp = MissalBullet(self) exp.pos = np.random.randint(-100, 100, size=(1, 2)) exp.speed = 1 exp.target = main_sprite self.sprite_group.add(exp) self.framerate.tick(30) ticks = pygame.time.get_ticks() exp.explode(ticks) self.controller.main_actor = main_sprite
sprite_group.add(sa) sa.attack_range = 20 # sa=Tiaotiao(screen) # sa.pos=np.random.randint(-100,100, size=(1,2)) # group.add(sa) # sa=Xiaohua(screen) # sa.pos=np.random.randint(-100,100, size=(1,2)) # sprite_group.add(sa) # sa=Yaorao(screen) # sa.speed=20 # sa.pos=np.random.randint(-100,100, size=(1,2)) # group.add(sa) map = Map() # sa.init_frame(*resource.get_surface("ghost")) controller.main_actor = sa while True: framerate.tick(30) ticks = pygame.time.get_ticks() for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() exit() if event.type == pygame.MOUSEBUTTONDOWN: x, y = event.pos
def init_elements_mapEditor(self): self.view_port = ViewPort() self.controller = UserController() self.resource = Resources() self.sprite_group = IGroup() self.map = Map()