-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
77 lines (71 loc) · 2.52 KB
/
main.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
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
pygame.init()
clock = pygame.time.Clock()
scrn = pygame.display.set_mode((300, 300))
pygame.display.set_caption('Mr. Jackson Spinner')
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
mrJ = pygame.transform.scale(pygame.image.load('img/mrj.png'), (300, 300))
img = 1
rotation = 0
rpf = 5
move = False
show = True
x, y = 0, 0
pos = (0, 0)
font = pygame.font.SysFont('arial', 12)
while True:
for e in pygame.event.get():
if e.type == pygame.QUIT or (e.type == pygame.KEYDOWN and e.key == pygame.K_q):
pygame.quit()
elif e.type == pygame.MOUSEBUTTONDOWN:
if abs(rpf) > 40:
rpf = 0
else:
if rpf < 0:
rpf -= 5
else:
rpf += 5
elif e.type == pygame.KEYDOWN:
if e.key == pygame.K_SPACE:
rpf *= -1
if e.key == pygame.K_f:
if move:
scrn = pygame.display.set_mode((300, 300))
move = False
x, y = (0, 0)
else:
scrn = pygame.display.set_mode((1280, 690))
move = True
if e.key == pygame.K_j:
if img == 1:
mrJ = pygame.transform.scale(pygame.image.load('img/green.png'), (300, 300))
img = 2
elif img == 2:
mrJ = pygame.transform.scale(pygame.image.load('img/coday.png'), (300, 300))
img = 3
elif img == 3:
mrJ = pygame.transform.scale(pygame.image.load('img/mrj.png'), (300, 300))
img = 1
if e.key == pygame.K_h:
if show:
show = False
else:
show = True
elif e.type == pygame.MOUSEMOTION and move:
pos = e.pos
x = pos[0] - 150
y = pos[1] - 150
scrn.fill(WHITE)
if show:
scrn.blit(font.render('Fullscreen/Move: f', True, BLACK), (5, 5))
scrn.blit(font.render('Direction: space', True, BLACK), (5, 17))
scrn.blit(font.render('Change Face: j', True, BLACK), (5, 29))
scrn.blit(font.render('Quit: q', True, BLACK), (5, 41))
scrn.blit(font.render('Hide: h', True, BLACK), (5, 53))
rotated = pygame.transform.rotate(mrJ, rotation)
rotation += rpf
new_rect = rotated.get_rect(center=mrJ.get_rect(topleft=(x, y)).center)
scrn.blit(rotated, new_rect)
pygame.display.update()
clock.tick(60)