Misje
This commit is contained in:
parent
1eb21960ec
commit
ee4d769167
52
statek.py
52
statek.py
|
|
@ -82,7 +82,7 @@ def strzal_z_karabinu():
|
|||
amo['value'] = magazynek
|
||||
|
||||
if firerate <= 0 < magazynek and pelny:
|
||||
firerate = 5
|
||||
firerate = 0.1
|
||||
magazynek -= 1
|
||||
wspol = canvas.coords(dul)
|
||||
xs = [wspol[i] for i in range(0, len(wspol), 2)]
|
||||
|
|
@ -135,8 +135,8 @@ def stzal_gluwny(event):
|
|||
def cele_ruch():
|
||||
global cele
|
||||
x1, y1, x2, y2, x3, y3, x4, y4 = canvas.coords(dul)
|
||||
celx=int((x1+x2+x3+x4)/4)
|
||||
cely=int((y1+y2+y3+y4)/4)
|
||||
celx = int((x1 + x2 + x3 + x4) / 4)
|
||||
cely = int((y1 + y2 + y3 + y4) / 4)
|
||||
for idx, c in enumerate(cele):
|
||||
if c["x1"] < celx:
|
||||
c["l"] = False
|
||||
|
|
@ -150,8 +150,8 @@ def cele_ruch():
|
|||
canvas.move(c["id"], 1, 0)
|
||||
c["x1"] += 1
|
||||
c["x2"] += 1
|
||||
c["ip"].place(x=c["x1"]+2.5,y=c["y1"]-10)
|
||||
c["ip"]['value']=c["hp"]
|
||||
c["ip"].place(x=c["x1"] + 2.5, y=c["y1"] - 10)
|
||||
c["ip"]['value'] = c["hp"]
|
||||
|
||||
|
||||
def aktualizuj_karabiny():
|
||||
|
|
@ -222,7 +222,7 @@ def aktualizuj_karabiny():
|
|||
if cele_zniszczone == cel_wymagany:
|
||||
tekst_celu["text"] = "MISJA UKOŃCZONA! ZNISZCZYŁEŚ CELE!"
|
||||
tekst_celu["foreground"] = "gold"
|
||||
root.after(5000, lambda: tekst_celu.pack_forget())
|
||||
root.after(5000, lambda: tekst_celu.place_forget())
|
||||
|
||||
kamyki_do_usuniecia.sort(reverse=True)
|
||||
for idx in kamyki_do_usuniecia:
|
||||
|
|
@ -265,6 +265,26 @@ def aktualizuj_karabiny():
|
|||
karabiny.pop(idx)
|
||||
|
||||
|
||||
def misja():
|
||||
print("X")
|
||||
global ktura_misja, cele, cele_zniszczone, cel_wymagany
|
||||
ktura_misja += 1
|
||||
tekst_celu.place(x=20, y=20)
|
||||
tekst_celu["text"] = f"misja {ktura_misja}"
|
||||
cele = []
|
||||
cele_zniszczone = 0
|
||||
cel_wymagany = ktura_misja * 5
|
||||
|
||||
for i in range(cel_wymagany):
|
||||
cx = randrange(200, 900)
|
||||
cy = randrange(200, 600)
|
||||
wrog_id = canvas.create_polygon(cx, cy, cx + 30, cy, cx + 30, cy + 20, cx, cy + 20, fill="red3", outline="black")
|
||||
hp_wrog_id = ttk.Progressbar(root, orient="horizontal", length=25, mode="determinate", style="wrog.Horizontal.TProgressbar", maximum=60)
|
||||
hp_wrog_id.place(x=cx, y=cy - 10)
|
||||
hp_wrog_id['value'] = 10
|
||||
cele.append({"id": wrog_id, "x1": cx, "y1": cy, "x2": cx + 30, "y2": cy + 20, "hp": 60, "l": True, "ip": hp_wrog_id})
|
||||
|
||||
|
||||
def aktualizuj_pociski():
|
||||
global cele_zniszczone
|
||||
szerokosc_okna = canvas.winfo_width()
|
||||
|
|
@ -318,13 +338,15 @@ def aktualizuj_pociski():
|
|||
canvas.tag_lower(slad_id)
|
||||
|
||||
canvas.delete(c["id"])
|
||||
c["ip"].place_forget()
|
||||
cele.pop(idx)
|
||||
cele_zniszczone += 1
|
||||
tekst_celu["text"] = f"Cele do zniszczenia: {cele_zniszczone}/{cel_wymagany}"
|
||||
if cele_zniszczone == cel_wymagany:
|
||||
tekst_celu["text"] = "MISJA UKOŃCZONA! ZNISZCZYŁEŚ CELE!"
|
||||
tekst_celu["foreground"] = "gold"
|
||||
|
||||
root.after(5000, lambda: tekst_celu.place_forget())
|
||||
root.after(7000, misja)
|
||||
kamyki_do_usuniecia.sort(reverse=True)
|
||||
for idx in kamyki_do_usuniecia:
|
||||
kam = kamycki[idx]
|
||||
|
|
@ -457,10 +479,10 @@ def gluwna():
|
|||
|
||||
if czekajmagazynek > 0:
|
||||
czekajmagazynek = czekajmagazynek - 1
|
||||
amo['value'] = 40 - (czekajmagazynek / 8)
|
||||
amo['value'] = 160 - (czekajmagazynek / 2)
|
||||
|
||||
if czekajmagazynek == 0:
|
||||
magazynek = 40
|
||||
magazynek = 160
|
||||
pelny = True
|
||||
amo['value'] = magazynek
|
||||
|
||||
|
|
@ -560,7 +582,7 @@ wcisniete_klawisze = {"w": False, "s": False, "a": False, "d": False, "q": False
|
|||
karabiny = []
|
||||
pociski = []
|
||||
firerate = 0
|
||||
magazynek = 40
|
||||
magazynek = 160
|
||||
czekajmagazynek = 0
|
||||
pelny = True
|
||||
|
||||
|
|
@ -568,7 +590,7 @@ style = ttk.Style()
|
|||
style.theme_use('default')
|
||||
style.configure("szary.Horizontal.TProgressbar", troughcolor="grey15", background="grey61", thickness=15, borderwidth=1)
|
||||
style.configure("zielony.Horizontal.TProgressbar", troughcolor="darkgreen", background="green3", thickness=15, borderwidth=1, lightcolor="green3", darkcolor="green3", bordercolor="green4")
|
||||
amo = ttk.Progressbar(root, orient="horizontal", length=300, mode="determinate", style="szary.Horizontal.TProgressbar", maximum=40)
|
||||
amo = ttk.Progressbar(root, orient="horizontal", length=300, mode="determinate", style="szary.Horizontal.TProgressbar", maximum=160)
|
||||
amo.place(x=400, rely=1.0, y=-50)
|
||||
amo['value'] = magazynek
|
||||
|
||||
|
|
@ -614,7 +636,7 @@ for tekst in teksty_napisow:
|
|||
cele = []
|
||||
cele_zniszczone = 0
|
||||
cel_wymagany = 5
|
||||
|
||||
ktura_misja = 1
|
||||
tekst_celu = Label(root, text=f"Cele do zniszczenia: {cele_zniszczone}/{cel_wymagany}", background="darkolivegreen", foreground="white", font=("Arial", 14, "bold"))
|
||||
tekst_celu.place(x=20, y=20)
|
||||
style.configure("wrog.Horizontal.TProgressbar", troughcolor="darkgreen", background="green3", borderwidth=0, thickness=6)
|
||||
|
|
@ -622,10 +644,10 @@ for i in range(cel_wymagany):
|
|||
cx = randrange(200, 900)
|
||||
cy = randrange(200, 600)
|
||||
wrog_id = canvas.create_polygon(cx, cy, cx + 30, cy, cx + 30, cy + 20, cx, cy + 20, fill="red3", outline="black")
|
||||
hp_wrog_id = ttk.Progressbar(root, orient="horizontal", length=25, mode="determinate", style="wrog.Horizontal.TProgressbar", maximum=10)
|
||||
hp_wrog_id.place(x=cx, y=cy-10)
|
||||
hp_wrog_id = ttk.Progressbar(root, orient="horizontal", length=25, mode="determinate", style="wrog.Horizontal.TProgressbar", maximum=60)
|
||||
hp_wrog_id.place(x=cx, y=cy - 10)
|
||||
hp_wrog_id['value'] = 10
|
||||
cele.append({"id": wrog_id, "x1": cx, "y1": cy, "x2": cx + 30, "y2": cy + 20,"hp":10, "l": True,"ip":hp_wrog_id})
|
||||
cele.append({"id": wrog_id, "x1": cx, "y1": cy, "x2": cx + 30, "y2": cy + 20, "hp": 60, "l": True, "ip": hp_wrog_id})
|
||||
|
||||
kamycki = []
|
||||
for i in range(60):
|
||||
|
|
|
|||
Loading…
Reference in a new issue