-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
78 lines (53 loc) · 1.93 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
78
import pygame, sys, math, time
from itertools import cycle
from pygame.locals import *
from pong import *
from main import *
BLINK_EVENT = pygame.USEREVENT + 0
### DEFINIÇÃO DAS VARIÁVEIS CONTENDO AS IMAGENS
Opening = pygame.image.load('Assets/Others/Opening.png')
Menu = pygame.image.load('Assets/Others/Menu.png')
Clock = pygame.time.Clock()
pygame.init()
pygame.display.set_caption('EMULE')
pygame.display.set_icon(pygame.image.load('Assets/Others/Icon.png'))
DISPLAY = pygame.display.set_mode((400, 450))
def opening():
### ANIMAÇÃO DO ELEMENTO DO MENU 'OPENING'
onOpeningElement = pygame.image.load('Assets/Others/OpeningElement.png')
blinkRect = onOpeningElement.get_rect()
offOpeningElement = pygame.Surface(blinkRect.size)
offOpeningElement.fill((0, 0, 0))
blinkSurfaces = cycle([onOpeningElement, offOpeningElement])
blinkSurface = next(blinkSurfaces)
pygame.time.set_timer(BLINK_EVENT, 1000)
DISPLAY.blit(Opening, (0, 0))
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == K_SPACE:
menu()
if event.type == BLINK_EVENT:
blinkSurface = next(blinkSurfaces)
DISPLAY.blit(blinkSurface, (78, 423))
pygame.display.update()
Clock.tick(60)
def menu():
while True:
DISPLAY.blit(Menu, (0, 0))
rect = pygame.Rect(133, 255, 132, 36)
mouse = pygame.mouse.get_pos()
mouseOnRect = rect.collidepoint(mouse)
if mouseOnRect == True:
Jogo = Pong()
Jogo.executar()
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
pygame.display.update()
Clock.tick(60)
opening()