-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdvd-corner.py
49 lines (38 loc) · 1.1 KB
/
dvd-corner.py
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
# https://github.com/Tomeczekqq/dvd-corner
from random import randint
import pygame
exit = False
# Settings
SIZE = width, height = 800, 600 # Resolution. (4:3)!
BG_COLOR = (0, 0, 0) # Background color in RGB
fullscreen = False # Fullscreen
logo = pygame.image.load('logo.png')
logo = pygame.transform.scale(logo, (100, 50))
clock = pygame.time.Clock()
img_size = logo.get_rect().size
screen = pygame.display.set_mode(SIZE)
pygame.display.set_caption('DVD Corner')
if fullscreen:
DISPLAYSURF = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
pygame.mouse.set_visible(False)
x = randint(50, width-60)
y = randint(50, height-60)
x_speed = 2.5
y_speed = 2.5
def move(x, y):
screen.blit(logo, (x, y))
while exit == False:
screen.fill(BG_COLOR)
if (x + img_size[0] >= width) or (x <= 0):
x_speed = -x_speed
if (y + img_size[1] >= height) or (y <= 0):
y_speed = -y_speed
x += x_speed
y += y_speed
move(x, y)
pygame.display.update()
clock.tick(60)
for event in pygame.event.get():
if event.type == pygame.QUIT:
exit = True
pygame.quit()