From 2919d159e78d8c03667b75f2bcea0e8509b9d7bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vio=20Code=C3=A7o=20Coelho?= Date: Sat, 22 May 2021 23:48:11 -0300 Subject: [PATCH] Fase 5 --- README.md | 4 ++ coronashooter/imagens/tiro.png | Bin 0 -> 26585 bytes coronashooter/main.py | 125 ++++++++++++++++++++++++++++++--- 3 files changed, 120 insertions(+), 9 deletions(-) create mode 100644 coronashooter/imagens/tiro.png diff --git a/README.md b/README.md index 93978ba..da1aeab 100644 --- a/README.md +++ b/README.md @@ -68,3 +68,7 @@ Veja como o jogo ficou. git checkout Fase_4 ``` +## Fase 5 +Na fase 5 vamos adicionar tiros e colisões para completar o Jogo. + +Os tiros serão implementados como uma classe. diff --git a/coronashooter/imagens/tiro.png b/coronashooter/imagens/tiro.png new file mode 100644 index 0000000000000000000000000000000000000000..aaefeb65d49ec3525c367cbbffd9fb569a872794 GIT binary patch literal 26585 zcmV(;K-<5GP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O2(Ab|g6tu8(HH-&sfC`H%G# z{|)%J!)N#%kFW6=Bj38_iUs+Y-u2((crVb$B41ybpR0d=^<(i}-QV{=)-vuj!WUnE zV8i#tmnD9^*xw^^pFcQS@PABa|FhP}YfYV9JtI~$Ziza~wL1JAe6V53z5H6lpM-w` zzE1L|;7>m4(Xlz>=tsk!Zi{u;m1XQ{hpl$mDgW)ZV~D4lF5$ne$tsCLpAtth7e*%A)8P_jXs_+#28bglB>z5 zGldjWN;#EOv(IM^Ip&meF1Z$0Jak|vv80kqDYZIN@uG@nReZkUJIyuU&K6p1spVE$ z?GT@S_RwQbJ@?YSbrQH|*fDon?0Di1K%gD>?8x>!9e0j#}2d z3c03-$LX8CO=r#O{#^KL#!jr})0!^w@Ay}Xt2BP?=9nS&QJTjCW1lIlmd-k7TQNZ& zLMBaHbBrXv+F-qN8(0*Z*T4Wf9_Djh$t_47mJG7s&VmQ6>G?~s!fZl$E_;|Z?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9*G~9B>Jdma^}E{X3FCh&=?d7B}Eg{zvjdqTTx!_vNO%SdgK*U z*V;M^Je@vrCIoKz{r>I2#iVR41KBad(xv~&SiKSV`^Dy`Z}tujbU2fG`$a#kq@es< zCP7omWm0eiaG5Eu)Z&Y1u2j_$i)wb@D?XCAy$!k3J_SF4z9AuX_evG;z5!{^1Bnfs zKc`5L4(q-F7hCtX>@Du6;J;%Gvb_p3R}xBp>*S;XG852t&{S2anJW`@+lXFh_11}* z;+WbwWzJMDRbplYHeDuY>iydDl==ahjw#5&#TNK0&}s$kfPbx4Yiq?!5jO=>|I?|1 z-O=&vOO&L~a>wlyuix&=W;eljC7OAWG+06KZ5tarHa2xycu_>u)Xm*t^AB`IGz?s4 za(=1x(3p|dw;nJJ^&-R`%?QeMcx0q)WmHSD@*Ey}<#}lUewPOVS@7Mo0fedE?e8%P zxq46nA&W9@_q&`O9hb>_Yt{|{*kx4CTA;l}k!+iGykd4SKIIpni|pth)oPy` z9S20g|Fvf4<3otdp~+-VS_Jt=V6DWj48{!aZc=pK7E# 10 and self.level == 0: + self.fundo = Fundo("tile2.png") + self.nivel = 1 + self.jogador.set_lives(self.jogador.get_lives() + 3) + elif xp > 50 and self.level == 1: + self.fundo = Fundo("tile3.png") + self.nivel = 2 + self.jogador.set_lives(self.player.get_lives() + 6) + def atualiza_elementos(self, dt): self.fundo.update(dt) for v in self.elementos.values(): @@ -48,6 +61,40 @@ def desenha_elementos(self): for v in self.elementos.values(): v.draw(self.tela) + def verifica_impactos(self, elemento, list, action): + if isinstance(elemento, pygame.sprite.RenderPlain): + hitted = pygame.sprite.groupcollide(elemento, list, 1, 0) + for v in hitted.values(): + for o in v: + action(o) + return hitted + + elif isinstance(elemento, pygame.sprite.Sprite): + if pygame.sprite.spritecollide(elemento, list, 1): + action() + return elemento.morto + + def ação_elemento(self): + self.verifica_impactos(self.jogador, self.elementos["tiros_inimigo"], + self.jogador.alvejado) + if self.jogador.morto: + self.run = False + return + + # Verifica se o personagem trombou em algum inimigo + self.verifica_impactos(self.jogador, self.elementos["virii"], + self.jogador.colisão) + if self.jogador.morto: + self.run = False + return + # Verifica se o personagem atingiu algum alvo. + hitted = self.verifica_impactos(self.elementos["tiros"], + self.elementos["virii"], + Virus.alvejado) + + # Aumenta a pontos baseado no número de acertos: + self.jogador.set_pontos(self.jogador.get_pontos() + len(hitted)) + def trata_eventos(self): event = pygame.event.poll() if event.type == pygame.QUIT: @@ -57,6 +104,9 @@ def trata_eventos(self): key = event.key if key == K_ESCAPE: self.run = False + elif key in (K_LCTRL, K_RCTRL): + self.interval = 0 + self.jogador.atira(self.elementos["tiros"]) elif key == K_UP: self.jogador.accel_top() elif key == K_DOWN: @@ -66,25 +116,29 @@ def trata_eventos(self): elif key == K_LEFT: self.jogador.accel_left() + keys = pygame.key.get_pressed() + if self.interval > 10: + self.interval = 0 + if keys[K_RCTRL] or keys[K_LCTRL]: + self.jogador.atira(self.elementos["tiros"]) + def loop(self): clock = pygame.time.Clock() dt = 16 self.elementos['virii'] = pygame.sprite.RenderPlain(Virus([120, 50])) - # enemy = Virus([0, 0]) - # enemy.set_pos([50, 50]) - # self.elementos['virii'].add(enemy) self.jogador = Jogador([200, 400], 5) self.elementos['jogador'] = pygame.sprite.RenderPlain(self.jogador) + self.elementos['tiros'] = pygame.sprite.RenderPlain() + self.elementos['tiros_inimigo'] = pygame.sprite.RenderPlain() while self.run: clock.tick(1000 / dt) self.trata_eventos() + self.ação_elemento() self.manutenção() # Atualiza Elementos self.atualiza_elementos(dt) - - # Desenhe no back buffer self.desenha_elementos() pygame.display.flip() @@ -105,7 +159,18 @@ def set_lives(self, lives): self.lives = lives def colisão(self): - if self.get_lives() == 0: + if self.get_lives() <= 0: + self.kill() + else: + self.set_lives(self.get_lives() - 1) + + def atira(self, lista_de_tiros, image=None): + s = list(self.get_speed()) + s[1] *= 2 + Tiro(self.get_pos(), s, image, lista_de_tiros) + + def alvejado(self): + if self.get_lives() <= 0: self.kill() else: self.set_lives(self.get_lives() - 1) @@ -132,7 +197,7 @@ def accel_right(self): class Virus(Nave): - def __init__(self, position, lives=0, speed=None, image=None, size=(100, 100)): + def __init__(self, position, lives=1, speed=None, image=None, size=(100, 100)): if not image: image = "virus.png" super().__init__(position, lives, speed, image, size) @@ -181,6 +246,48 @@ def get_pontos(self): def set_pontos(self, pontos): self.pontos = pontos + def atira(self, lista_de_tiros, image=None): + l = 1 + if self.pontos > 10: l = 3 + if self.pontos > 50: l = 5 + + p = self.get_pos() + speeds = self.get_fire_speed(l) + for s in speeds: + Tiro(p, s, image, lista_de_tiros) + + def get_fire_speed(self, shots): + speeds = [] + + if shots <= 0: + return speeds + + if shots == 1: + speeds += [(0, -5)] + + if shots > 1 and shots <= 3: + speeds += [(0, -5)] + speeds += [(-2, -3)] + speeds += [(2, -3)] + + if shots > 3 and shots <= 5: + speeds += [(0, -5)] + speeds += [(-2, -3)] + speeds += [(2, -3)] + speeds += [(-4, -2)] + speeds += [(4, -2)] + + return speeds + + +class Tiro(ElementoSprite): + def __init__(self, position, speed=None, image=None, list=None): + if not image: + image = "tiro.png" + super().__init__(image, position, speed) + if list is not None: + self.add(list) + if __name__ == '__main__': J = Jogo()