Created
October 27, 2018 06:46
-
-
Save hanjae-jea/a5c35ef1ccf86f87f06275445afab832 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
import time | |
clock = pygame.time.Clock() | |
pygame.init() | |
screen = pygame.display.set_mode((400,400)) | |
done = False | |
x=0 | |
y=0 | |
g=200 | |
h=200 | |
b=0 | |
start=0 | |
end = 0 | |
font = pygame.font.SysFont('Comic Sans MS' ,30) | |
while done == False: | |
for event in pygame.event.get(): | |
if event.type == pygame.QUIT: | |
done = True | |
xy = pygame.mouse.get_pos() | |
if event.type == pygame.MOUSEBUTTONUP and 185 <=xy[0] <= 215 and 185 <= xy[1] <= 215: | |
b = b + 1 | |
if b == 1: | |
start = pygame.time.get_ticks() | |
screen.fill((22,233,190)) | |
sf = font.render(str(b), False, (128, 128, 128)) | |
screen.blit(sf, (100, 100)) | |
if start != 0: | |
end = pygame.time.get_ticks() | |
sf = font.render(str( round((end - start)/1000) ), False, (128, 128, 128)) | |
screen.blit(sf, (200, 100)) | |
pygame.draw.circle(screen,(255,255,0),(g,h),30) | |
pygame.display.flip() | |
clock.tick(60) | |
end = pygame.time.get_ticks() | |
if (end - start)/1000 >= 10: | |
djk = pygame.font.SysFont('Comic Sans MS',30) | |
fff = font.render("fail", False, (255,0,0)) | |
screen.blit(fff, (50,50)) | |
pygame.display.flip() | |
done = True | |
elif b == 80 and (end - start)/1000 <= 5: | |
hehe = pygame.font.SysFont('Comic Sans MS',50) | |
ggg = font.render("great",False, (0,64,0)) | |
screen.blit(ggg, (50, 50)) | |
pygame.display.flip() | |
done = True | |
elif b == 80: | |
haha = pygame.font.SysFont('Comic Sans MS', 50) | |
sss = font.render("success", False, (33, 1, 254)) | |
screen.blit(sss, (50, 50)) | |
pygame.display.flip() | |
done = True | |
while True: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment