-
Notifications
You must be signed in to change notification settings - Fork 4
/
wave.py
53 lines (40 loc) · 1.28 KB
/
wave.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
import math
import pygame
import time
def text_objects(text, font):
textSurface = font.render(text, True, (255,200,76))
return textSurface, textSurface.get_rect()
def wave(time_to_run, quitf=True):
local_time = time.time()
pygame.init()
screen = pygame.display.set_mode((1920,1080), pygame.FULLSCREEN)
t = 0
white = (245,245,245)
color = (129,102,205)
running = True
while running:
if (time.time()-local_time) >= time_to_run:
running = False
# for event in pygame.event.get():
# if event.type == pygame.KEYDOWN:
# running = False
x = t
y = math.sin(t/50.0) * 500 + 400
t+=10
t%=(4 *540)
y = int(y)
screen.fill(white)
pygame.draw.circle(screen, color, (x, y+100), 20)
largeText = pygame.font.Font('Raleway-Medium.ttf',60)
# pygame.draw.circle(screen,color, position, radius, width)
TextSurf, TextRect = text_objects("Follow the Dot", largeText)
TextRect.center = ((950),(500))
screen.blit(TextSurf, TextRect)
pygame.display.flip()
milliseconds = 30
pygame.time.delay(milliseconds)
if quitf:
pygame.display.quit()
pygame.quit()
if __name__ == '__main__':
wave()