Files
Stock-Game/Jan IT-Club Thing/dvd.py

57 lines
1.1 KiB
Python

import pygame
import random
import os
import sys
import time
pygame.init()
screen = pygame.display.set_mode((1920, 1080))
pygame.display.set_caption("Simple Pygame Example")
clock = pygame.time.Clock()
font = pygame.font.SysFont(None, 55)
WHITE = (255, 255, 255)
x = 20
y = 20
xbool = False
ybool = False
toWrite = "Drugs"
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
screen.fill((0, 0, 0))
text = font.render(toWrite, True, WHITE)
screen.blit(text, (x, y))
text_width, text_height = font.size(toWrite)
pygame.display.flip()
clock.tick(60)
if x > (screen.get_width() - text_width) or xbool:
x = x - 1
xbool = True
else:
x = x + 1
xbool = False
if y > (screen.get_height() - text_height) or ybool:
y = y - 1
ybool = True
else:
y = y + 1
ybool = False
if y < 0:
y = 0
ybool = False
if x < 0:
x = 0
xbool = False
print(x, y)
time.sleep(0.01)