-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDVD Logo.py
More file actions
77 lines (61 loc) · 1.66 KB
/
DVD Logo.py
File metadata and controls
77 lines (61 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import pygame
import math
import pyautogui
# Initialization
pygame.init()
screen = pygame.display.set_mode(pyautogui.size(), pygame.SCALED, vsync = 1)
clock = pygame.time.Clock()
running = True
logo = pygame.image.load(r"src/DVD_logo.svg.png")
logo = logo.convert_alpha()
logo = pygame.transform.scale(logo, (400, 204))
colorlist = ["white", "red", "darkorange", "yellow", "green", "aqua", "blue", "purple", "hotpink"]
logolist = []
w = logo.get_width()
h = logo.get_height()
index = 0
for color in colorlist:
logolist.append(logo.copy())
for x in range(w):
for y in range(h):
if logolist[index].get_at((x,y)).a >= 1:
logolist[index].set_at((x, y), color)
index += 1
index = 0
def nextlogo():
global index
global logo
if index < len(logolist) - 1:
index += 1
logo = logolist[index]
else:
index = 0
logo = logolist[index]
logo = logolist[0]
x = screen.get_width() / 2 - logo.get_width() / 2
y = screen.get_height() / 2 - logo.get_height() / 2
xvel = 5
yvel = 5
# Run Loop
while running:
# Stops when program exit
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
# Resets Screen
screen.fill("black")
screen.blit(logo, (x, y))
x += xvel
y += yvel
if x <= 0 or x >= screen.get_width() - logo.get_width():
xvel *= -1
nextlogo()
if y <= 0 or y >= screen.get_height() - logo.get_height():
yvel *= -1
nextlogo()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
running = False
pygame.display.flip()
clock.tick(60)
pygame.quit()