In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
< 0 or rect.left + SIDE >= SCREEN_WIDTH: return False for ba in self.barrier: if rect.colliderect (ba.rect): return False self.body = rect return True def get_score (self) Ba): if self.body.top > ba.rect.top and not ba.score: self.score + = 1 ba.score = True def to_hell (self): self.body.top + = 2 for ba in self.barrier: if not self.body.colliderect (ba.rect): self.get_score (ba) Continue if ba.type = = DEADLY: self.show_end () return self.body.top = ba.rect.top-SIDE-2 if ba.type = = FRAGILE: ba.frag_touch = True elif ba.type = = BELT_LEFT or ba.type = = BELT_RIGHT: # self.body.left + = ba.belt_dire self.move_man (ba.belt_dire) break top = self.body.top if top
< 0 or top+SIDE >= SCREEN_HEIGHT: self.show_end () def create_barrier (self): solid = list (filter (lambda ba: ba.type = = SOLID, self.barrier)) if len (solid)
< 1: self.barrier.append(Barrier(self.screen, SOLID)) else: self.barrier.append(Barrier(self.screen)) self.last = randint(3, 5) * SIDE def update(self, current_time): if self.end or self.is_pause: return self.last -= 1 if self.last == 0: self.create_barrier() for ba in self.barrier: if not ba.rise(): if ba.type == FRAGILE and ba.rect.top >0: self.score + = 1 self.barrier.remove (ba) self.move_man (self.dire) self.move_man (self.dire) self.to_hell () def draw (self, current_time, end=False): if self.end or self.is_pause: return self.screen.fill (0x000000) self.draw_score ((0x3c 0x3c, 0x3c)) for ba in self.barrier: ba.draw () if not end: self.screen.fill (COLOR [BODY], self.body) else: self.screen.fill (COLOR [DEADLY], self.body) pygame.display.update () if _ _ name__ = ='_ main__': hell = Hell ("one hundred layers", (SCREEN_WIDTH) SCREEN_HEIGHT)) hell.run ()
The effect picture is as follows:
The above is all the content of the article "how to achieve 100-tier games in Pygame". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.