for col in range(F.map_rows): pygame.draw.rect( DISPLAYSUR, F.board_frame_color, (col * F.tile_size + F.board_origin_1[0], row * F.tile_size + F.board_origin_1[1], F.tile_size, F.tile_size)) pygame.draw.rect( DISPLAYSUR, F.board_color, (col * F.tile_size + F.board_origin_1[0] + F.board_frame_px, row * F.tile_size + F.board_origin_1[1] + F.board_frame_px, F.tile_size - 2 * F.board_frame_px, F.tile_size - 2 * F.board_frame_px)) # render the moving blocks if controller.game_status == 21: if mover_0.remain_moving_frames > 0 and if_moved_0: mover_0.move_all() for row in range(F.map_rows): for col in range(F.map_cols): if mover_0.blocks[row][col]: # the tile background moving_tile_pos = ( mover_0.blocks[row][col].y * F.tile_size + F.board_origin_0[0] + F.board_frame_px, mover_0.blocks[row][col].x * F.tile_size + F.board_origin_0[1] + F.board_frame_px) moving_tile_rect = moving_tile_pos + ( F.tile_size - 2 * F.board_frame_px, F.tile_size - 2 * F.board_frame_px) tile_color = F.tile_color[board_0.prev_board[row][col]] pygame.draw.rect(DISPLAYSUR, tile_color, moving_tile_rect)
(col * F.tile_size + F.board_offset_x + F.board_frame_px, row * F.tile_size + F.board_offset_y + F.board_frame_px, F.tile_size - 2 * F.board_frame_px, F.tile_size - 2 * F.board_frame_px)) pygame.draw.rect( DISPLAYSUR, F.star_tile_color, (F.star_pos[1] * F.tile_size + F.board_offset_x - F.board_frame_px, F.star_pos[0] * F.tile_size + F.board_offset_y - F.board_frame_px, F.tile_size + 2 * F.board_frame_px, F.tile_size + 2 * F.board_frame_px)) # render the moving blocks if controller.game_status == 21: if mover.remain_moving_frames > 0: mover.move_all() for row in range(F.map_rows): for col in range(F.map_cols): if mover.blocks[row][col]: # the tile background moving_tile_pos = ( mover.blocks[row][col].y * F.tile_size + F.board_offset_x + F.board_frame_px, mover.blocks[row][col].x * F.tile_size + F.board_offset_y + F.board_frame_px) if (row, col) == F.star_pos: DISPLAYSUR.blit( F.castle_textures[board.prev_board[row][col]], moving_tile_pos) else: DISPLAYSUR.blit(