From 48634a092626b3305ea9762ce79b38788bb289b5 Mon Sep 17 00:00:00 2001 From: Megamichi Date: Sun, 14 Jan 2024 13:48:08 +0100 Subject: [PATCH] alles mal in die engine gepumpt --- .../__pycache__/parabelfunc.cpython-311.pyc | Bin 3754 -> 3758 bytes physics/parabelfunc.py | 2 +- tengine/__pycache__/main.cpython-311.pyc | Bin 3674 -> 3678 bytes v2.py | 209 +++++++++--------- 4 files changed, 110 insertions(+), 101 deletions(-) diff --git a/physics/__pycache__/parabelfunc.cpython-311.pyc b/physics/__pycache__/parabelfunc.cpython-311.pyc index 833948268b8addec6ba5962b71c0b414463d5fd7..2c8f50e21c0ab8fb7478299d0bc156ce03e06ade 100644 GIT binary patch delta 105 zcmZ1_yH1vOIWI340}#wUv^X_;BX2I7Td;mcer~FMZfbgBZf0^urhag8Mp0^JQb}fU za)y3#eoAIux_(-IQF>}tK9E~pnVMP>Uy@pso0*rGqhF9wS)7?%tiO2=+c{=NkROlWaxQE`lKYI}teoS(Hd1Y#9Nqk9aQEp~lVopp!MrCnka&gS&18nD*8ErQAbIG#+ E03yUCSO5S3 diff --git a/physics/parabelfunc.py b/physics/parabelfunc.py index 1344dc5..3f8b7ce 100644 --- a/physics/parabelfunc.py +++ b/physics/parabelfunc.py @@ -98,7 +98,7 @@ if __name__ == "__main__": ymin = 0 xmin = 0 startwinkel = 34 - startgeschwindigkeit = 60 + startgeschwindigkeit = 20 starthoehe = 0 schlafzeit = 0.05 ### diff --git a/tengine/__pycache__/main.cpython-311.pyc b/tengine/__pycache__/main.cpython-311.pyc index cd0285d7e0f4eef6dd93269cb6a4521d1384813a..9215535f9998bd54320bd4545b52626570a1efff 100644 GIT binary patch delta 98 zcmca5b5DkMIWI340}xmqSe)9rk@pCrn~#1*er~FMZfbgBZf0^urhag8Mp0^JQb}fU za)y3#eoAIux_(-IQF>}tK9E~pnVMP>Uy@pso0*rGqhFGmm!6rIs=ry7$(;uPqF^H= delta 94 zcmca7b4!MIIWI340}!}-EK1$Jk@pCrlSi^uOlWaxQE`lKYI}teoS(Hd1Y#9Nqk9aQEp~lVopp+YF>I~UTVx{aVB>j04A>@djJ3c diff --git a/v2.py b/v2.py index b4c4f1a..a924915 100644 --- a/v2.py +++ b/v2.py @@ -1,34 +1,28 @@ #!/usr/bin/python3 -import os +#import os from tengine.main import *#ty,tx,clear,genfeld,strfeld,change_char,bg_char from pynput import keyboard from time import sleep from physics.parabelfunc import berechneflugbahn -import random - - -#def clear(): -# if os.name == "nt": -# os.system("cls") -# else: -# os.system("clear") - +import ascii +#import random def on_press(key): - global running + global key_space if key == keyboard.Key.space: - running = False + key_space = True def on_release(key): - global running + global running,key_space + if key == keyboard.Key.space: + key_space = False if key == keyboard.Key.esc: # Stop listener running = "finito" - +key_space = None listener = keyboard.Listener(on_press=on_press, on_release=on_release) - listener.start() txhalb = int(tx / 2)-2 @@ -36,93 +30,108 @@ wobble_speed = 0.01 wobble_pos = 0 wobble_way = "right" points = 0 +startscreen = True running = True -while running == True: - wobl = "-" * (tx - wobble_pos - 5) - wobr = "-" * wobble_pos - wobbl = f"{wobr}πŸ„οΈ{wobl}" - print(" " * txhalb, "↓") - print(f"[{wobbl}]") - print(wobble_pos) - print(points) - print(tx) - print(txhalb) + +if __name__ == "__main__" and running == True: + feld = genfeld() + feld = change_block(feld,ascii.logo,[1,int(tx/2-21)]) + + while startscreen == True: + feld = change_block(feld,ascii.start_screen_text,[10,int(tx/2-5)]) + print(strfeld(feld)) + sleep(0.2) + feld = viereck(feld,[11,int(tx/2-4)],11,1," ") + print(strfeld(feld)) + sleep(0.2) + clear() + if key_space == True: + while not key_space == False: + startscreen = False - if wobble_pos > txhalb: - wobble_site = "left" - else: - wobble_site = "right" - - if wobble_way == "right": - wobble_pos += 1 - if wobble_site == "right": - points += 1 + feld = bg_char(feld," ") + #feld = change_block[feld,ascii.cowsay,[int(tx/2-8),int(ty/2-2)]] + while running == True: + wobl = "-" * (tx - wobble_pos - 5) + wobr = "-" * wobble_pos + wobbl = f"{wobr}πŸ„οΈ{wobl}" + feld = change_block(feld," " * txhalb+"↓",[ty-3,0]) + feld = change_block(feld,f"[{wobbl}]",[ty-2,0]) + print(strfeld(feld)) + if wobble_pos > txhalb: + wobble_site = "left" else: - points -= 1 - else: - wobble_pos -= 1 - if wobble_site == "right": - points -= 1 - else: - points += 1 - - if wobble_pos >= tx - 4: - wobble_way = "left" - elif wobble_pos == 0: - wobble_way = "right" + wobble_site = "right" - sleep(wobble_speed) - clear() - - if running == "finito": - exit() - -#tx halb = max points #in ausgerechneten bruch und an in bruch mit nenner 100 ergibt zΓ€hler mit punktewert - -for a in range(int(points*2)): - print("-" * a + "πŸ„οΈ", end="\r") - sleep(0.01) - -points = int((points/txhalb)*100) -print("\n", points, "%") - -feld = genfeld() -# Randomly choose a cow -cows = "πŸ΅πŸ’πŸ¦πŸ¦§πŸ•πŸ―πŸ¦πŸ©πŸ…πŸ΄πŸŽπŸ¦„πŸ¦ŒπŸ—πŸ‚πŸƒπŸ„πŸͺπŸ«πŸ¦™πŸ¦’πŸΉπŸ¦˜πŸ¦‘πŸ§πŸ•ŠοΈ πŸ¦…πŸ¦†πŸ¦‰πŸπŸ¦ŽπŸŠπŸ¦œπŸ¦šπŸ¦©πŸ²πŸ‰πŸ¦•" -cowlistlength = len(cows) -cow = cows[random.randint(0, cowlistlength - 1)] -# Needed: find our screensize. We are in textmode here -#termsize_xy = os.get_terminal_size() -### I m p o r t a n t p a r a m e t e r s ### -# X-Resolution of the display -xmax = tx-1 #termsize_xy[0] - 1 -xsteps = 20#xmax -ymax = ty #termsize_xy[1] -ymin = 0 -xmin = 0 -startwinkel = 70 -startgeschwindigkeit = 60 -starthoehe = 0 -schlafzeit = 0.05 -### -# needed for erasing old position -xold = xmin -yold = ymin -x = xmin -y = xmin -# Call the function, which calculates the coordinates) -ergebnis = berechneflugbahn(xmax, ymax, xsteps, startwinkel, startgeschwindigkeit, starthoehe, gravitation=1, xstep=2) - -feld = bg_char(feld,"-") - -# here we draw the cow -for count in range(xmin, len(ergebnis), 2): - xold, yold = x, y - x, y = ergebnis[count], ergebnis[count + 1] - change_block(feld,"@",[x, y]) - sleep(schlafzeit) - change_block(feld,"#",[xold, yold]) #☁️ + if wobble_way == "right": + wobble_pos += 1 + if wobble_site == "right": + points += 1 + else: + points -= 1 + else: + wobble_pos -= 1 + if wobble_site == "right": + points -= 1 + else: + points += 1 + + if wobble_pos >= tx - 5: + wobble_way = "left" + elif wobble_pos == 0: + wobble_way = "right" + + sleep(wobble_speed) + clear() + + if key_space == True: + break + points_prozent = int((points/txhalb)*100) + for a in range(int(points*2)): + feld = change_block(feld,"-"*a+"πŸ„οΈ",[0,0]) + feld = change_block(feld,str(points_prozent)+"%",[1,int(tx/2-2)]) + print(strfeld(feld)) + sleep(0.01) + clear() print(strfeld(feld)) - print() -sleep(2) -#sys.exit(home + curon) \ No newline at end of file + + +## Randomly choose a cow +#cows = "πŸ΅πŸ’πŸ¦πŸ¦§πŸ•πŸ―πŸ¦πŸ©πŸ…πŸ΄πŸŽπŸ¦„πŸ¦ŒπŸ—πŸ‚πŸƒπŸ„πŸͺπŸ«πŸ¦™πŸ¦’πŸΉπŸ¦˜πŸ¦‘πŸ§πŸ•ŠοΈ πŸ¦…πŸ¦†πŸ¦‰πŸπŸ¦ŽπŸŠπŸ¦œπŸ¦šπŸ¦©πŸ²πŸ‰πŸ¦•" +#cowlistlength = len(cows) +#cow = cows[random.randint(0, cowlistlength - 1)] +## Needed: find our screensize. We are in textmode here +##termsize_xy = os.get_terminal_size() +#### I m p o r t a n t p a r a m e t e r s ### +## X-Resolution of the display +#xmax = tx-1 #termsize_xy[0] - 1 +#xsteps = 20#xmax +#ymax = ty #termsize_xy[1] +#ymin = 0 +#xmin = 0 +#startwinkel = 70 +#startgeschwindigkeit = 60 +#starthoehe = 0 +#schlafzeit = 0.05 +#### +## needed for erasing old position +#xold = xmin +#yold = ymin +#x = xmin +#y = xmin +## Call the function, which calculates the coordinates) +#ergebnis = berechneflugbahn(xmax, ymax, xsteps, startwinkel, startgeschwindigkeit, starthoehe, gravitation=1, xstep=2) +# +#feld = bg_char(feld,"-") +# +## here we draw the cow +#for count in range(xmin, len(ergebnis), 2): +# xold, yold = x, y +# x, y = ergebnis[count], ergebnis[count + 1] +# change_block(feld,"@",[x, y]) +# sleep(schlafzeit) +# change_block(feld,"#",[xold, yold]) #☁️ +# print(strfeld(feld)) +# print() +#sleep(2) +##sys.exit(home + curon) \ No newline at end of file