def func(): clock = pygame.time.Clock() running = True ani = TimedAnimation([0.2, 0.2, 0.2, 0.2]) ani.loadFromDir(os.path.join("noise2/")) while running: dt = clock.tick(30)/1000. screen.fill((255, 0, 0)) for event in pygame.event.get(): if event.type == pygame.QUIT: running = False image = ani.next(dt) for y in range(0, 480, 64): for x in range(0, 640, 64): screen.blit(image, (x, y)) pygame.display.update()
import pygame import math import random from timedanimation import TimedAnimation import os pygame.init() size = (800, 600) y = -size[1] secs = 60 screen = pygame.display.set_mode(size) ani = TimedAnimation([0.2, 0.2, 0.2, 0.2]) ani.loadFromDir(os.path.join("noise2/")) tiles = [] redsurf = pygame.surface.Surface(size, pygame.SRCALPHA) whitesurf = pygame.surface.Surface((200, 200)) whitesurf.fill((255, 255, 255)) linesize = 3 overlay = None oy = 0.0 i = -1 # v-----------------------------------------------------------------v # ^-----------------------------------------------------------------^ clock = pygame.time.Clock() Truth = True time = 0.0 tm = 0.0 x = 50 while Truth: dt = clock.tick(30) / 1000.0 time += dt