import os
import time
# Palya meretei
SZELESSEG = 20
MAGASSAG = 10
# Kezdo-poziciok
labda_x = 5
labda_y = 5
labda_vx = 1
labda_vy = 1
uto_y = 4 # Az uto az utolso elotti oszlopban lesz (X = SZELESSEG - 2)
uto_x = SZELESSEG - 2
pontszam = 0
print("JATEK INDITASA!")
print("Iranyitas: 'w' + Enter (fel), 's' + Enter (le), vagy csak sima Enter (maradsz)\n")
time.sleep(2)
while True:
# 1. Palya kirajzolasa a memoriaban
palya = []
# Felso fal
palya.append("#" * (SZELESSEG + 2))
for y in range(MAGASSAG):
sor = [" "] * SZELESSEG
# Uto kirajzolasa (2 karakter magas uto)
if y == uto_y or y == uto_y + 1:
sor[uto_x] = "|"
# Labda kirajzolasa
if y == labda_y and 0 <= labda_x < SZELESSEG:
sor[labda_x] = "O"
palya.append("#" + "".join(sor) + "#")
# Also fal
palya.append("#" * (SZELESSEG + 2))
# Pontszam hozzaadasa
palya.append(f"Score: {pontszam}")
# Palya megjelenitese (sok ures sor, hogy tiszta legyen a kepernyo)
print("\n" * 15)
print("\n".join(palya))
# 2. Jatekos lepese (Bekeres)
mozdulat = input("Lepes (w/s/Enter): ").strip().lower()
if mozdulat == "w" and uto_y > 0:
uto_y -= 1
elif mozdulat == "s" and uto_y < MAGASSAG - 2:
uto_y += 1
# 3
---------------JATEK INDITASA!
Iranyitas: 'w' + Enter (fel), 's' + Enter (le), vagy csak sima Enter (maradsz)
######################
# #
# #
# #
# #
# | #
# O | #
# #
# #
# #
# #
######################
Score: 0
Lepes (w/s/Enter):
Nincsenek megjegyzések:
Megjegyzés küldése