pygame-surface-switching/surface_switching_test/surfaces/sf_3.py

21 lines
741 B
Python

import pygame
from surface_switching_test.surfaces.objects import text as surface_text
class Surface(pygame.Surface):
def __init__(self, window_size):
super().__init__(window_size, pygame.SRCALPHA)
self.test = 0
self.running = True
self.next_surface = 'sf_1'
self.countdown = 100
def update(self):
self.fill((0, 0, 255))
text = surface_text.RegularText('Surface stopping and swtiching to {0} in: {1}'.format(self.next_surface,
str(self.countdown)))
self.blit(text.surface, text.rect)
self.countdown -= 1
if self.countdown < 0:
self.running = False