Deleted old code.

This commit is contained in:
The Wobbler 2023-11-05 18:06:20 +01:00
parent 7f95f87baa
commit 28154248e5

View file

@ -1,118 +1 @@
#!/usr/bin/python3 #!/usr/bin/python3
import os
from time import sleep
from pynput import keyboard
FPS = 60
BLA_SPEED = 1
tx, ty = os.get_terminal_size().columns, os.get_terminal_size().lines
half_tx = round(tx / 2)
bla_pos = 1
bla_back = False
stop = None
yeet = None
yeet_dist = None
def clear():
if os.name == "nt":
os.system("cls")
else:
os.system("clear")
def on_press(key):
global stop
global yeet_dist
try:
if key == keyboard.Key.space:
if not stop:
stop = bla_pos
bla_dist = half_tx - bla_pos
if bla_dist < 0:
bla_dist = 0 - bla_dist
yeet_dist = tx - 2 - bla_dist * 2 - 10
except AttributeError:
# print('special key {0} pressed'.format(key))
pass
def on_release(key):
# print('{0} released'.format(key))
if key == keyboard.Key.esc:
# Stop listener
return False
def move_bla():
global bla_pos
global bla_back
print(" " * (half_tx - 1) + "")
print(" " * (bla_pos - 1) + "#")
if bla_back:
bla_pos -= BLA_SPEED
else:
bla_pos += BLA_SPEED
if bla_pos >= tx:
bla_back = True
elif bla_pos <= 1:
bla_back = False
def yeet_cow():
global yeet
global running
if not yeet:
yeet = 1
print("-" * (yeet - 1) + "🐄️")
if yeet >= yeet_dist:
running = False
yeet += 1
def loop():
clear()
if not stop:
move_bla()
else:
yeet_cow()
sleep(1 / FPS)
listener = keyboard.Listener(
on_press=on_press,
on_release=on_release)
listener.start()
running = True
try:
while running:
loop()
except KeyboardInterrupt:
clear()
print("Exit.")