tighogg

fighting game for the terminal
git clone https://git.ce9e.org/tighogg.git

commit
3936189462dcdd322ad2fe3171ecbf7ef7cb5bb6
parent
7f1fe6dd62f20bad9982cb7930a1c92e91f5aa7d
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2021-05-10 06:27
fix respawn leader

Diffstat

M tighogg.py 17 +++++++++--------

1 files changed, 9 insertions, 8 deletions


diff --git a/tighogg.py b/tighogg.py

@@ -285,14 +285,15 @@ class Game:
  285   285                         player.die()
  286   286 
  287   287                 # respawn on edge of screen
  288    -1                 if not self.straggler.alive and self.straggler.cooldown <= 0:
  289    -1                     if self.direction == RIGHT:
  290    -1                         x = self.leader.x + self.cols / 2
  291    -1                     else:
  292    -1                         x = self.leader.x - self.cols / 2
  293    -1                     if self.map.get_floor(x) is not math.inf:
  294    -1                         self.straggler.x = x
  295    -1                         self.straggler.alive = True
   -1   288                 for player in self.players:
   -1   289                     if not player.alive and player.cooldown <= 0:
   -1   290                         if player.base_direction == RIGHT:
   -1   291                             x = self.camera
   -1   292                         else:
   -1   293                             x = self.camera + self.cols
   -1   294                         if self.map.get_floor(x) is not math.inf:
   -1   295                             player.x = x
   -1   296                             player.alive = True
  296   297 
  297   298                 self.render()
  298   299                 time.sleep(1 / 30 - (time.time() - last))