Add files via upload
This commit is contained in:
41
beta2.py
Normal file
41
beta2.py
Normal file
@ -0,0 +1,41 @@
|
||||
# imports
|
||||
import keyboard as kb
|
||||
import time
|
||||
import random
|
||||
import pygame as pg
|
||||
|
||||
pg.init()
|
||||
|
||||
|
||||
# variables
|
||||
|
||||
sw = 960 # screen width
|
||||
sh = 540 # screen height
|
||||
PINK = (255, 120, 220)
|
||||
|
||||
# functions
|
||||
|
||||
def draw(n):
|
||||
pass
|
||||
|
||||
# main
|
||||
screen = pg.display.set_mode([sw, sh]) # first is x. Second - y.
|
||||
running = True
|
||||
while running:
|
||||
circlex = 0
|
||||
circley = 0
|
||||
for event in pg.event.get():
|
||||
if event.type == pg.QUIT:
|
||||
running = False
|
||||
if event.type == pg.MOUSEBUTTONDOWN and event.pos == (circlex, circley):
|
||||
pass
|
||||
screen.fill((0, 0, 0))
|
||||
|
||||
objcounter = 0
|
||||
for i in range(objcounter):
|
||||
draw(i)
|
||||
pg.draw.circle(screen, PINK, (random.randint(50, sw - 50), random.randint(50, sh - 50)), 50)
|
||||
|
||||
pg.display.flip()
|
||||
|
||||
pg.quit()
|
||||
34
main.py
Normal file
34
main.py
Normal file
@ -0,0 +1,34 @@
|
||||
#imports
|
||||
import keyboard as kb
|
||||
import time
|
||||
import random
|
||||
|
||||
#variables
|
||||
|
||||
#functions
|
||||
|
||||
def react(key):
|
||||
while True:
|
||||
print('Press shift to start.')
|
||||
kb.wait("shift")
|
||||
time.sleep(random.uniform(0.5, 5))
|
||||
print('uwu')
|
||||
startcounter = time.monotonic()
|
||||
kb.wait("shift")
|
||||
endcounter = time.monotonic()
|
||||
print('Reaction time is {:>9.4f}'.format(endcounter - startcounter))
|
||||
time.sleep(0.5)
|
||||
if(kb.is_pressed(key)):
|
||||
print('Closing game. Thanks for playing.')
|
||||
main()
|
||||
|
||||
#main
|
||||
def main():
|
||||
print('Choose the game:')
|
||||
print('React')
|
||||
|
||||
s = input()
|
||||
if (s == 'react' or s == 'React'):
|
||||
react('ctrl')
|
||||
|
||||
main()
|
||||
Reference in New Issue
Block a user