def render_shadow_block(self): shadow_tetra = Tetramine( self.current_tetra.scheme, self.current_tetra.current_orientation, self.current_tetra.rotations, self.current_tetra.renders, ) shadow_tetra.place(self.current_tetra.x, self.current_tetra.y) while (shadow_tetra.checkBoundaries(self) == True) and (shadow_tetra.checkCollisions(self) == True): shadow_tetra.place(shadow_tetra.x, shadow_tetra.y + 1) shadow_tetra.place(shadow_tetra.x, shadow_tetra.y - 1) shadow_tetra.render(self, center_color=(30, 140, 50), mino_color=(30, 140, 50))
tetra_list = default_tetra.Classic_Tetra() # Clock for framerate main_clock = pygame.time.Clock() # Set timer for tetra's drop pygame.time.set_timer(pygame.USEREVENT + 1, 600) # Set timer for tetra's transition to non-moving blocks transitionTimer = False pygame.time.set_timer(pygame.USEREVENT + 2, 0) # Choose a random tetra x = randint(0, 6) random_tetra, random_rotations, random_renders = tetra_list.get_tetra(x) current_tetra = Tetramine(random_tetra, 0, random_rotations, random_renders) current_tetra.place(5, 1) tetris.add_tetramino(current_tetra) while True: screen.fill((0, 0, 0)) tetris.removeLines() tetris.render() pygame.display.update() if tetris.current_tetra == None: x = randint(0, 6)