tighogg

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

commit
fda8d11cf0152bb5e121152adbf527b1510df782
parent
22c26011c28ac187f71e2383189bf1d75578a8a4
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2021-05-08 08:42
actually move players

Diffstat

M tighogg.py 9 +++++++++

1 files changed, 9 insertions, 0 deletions


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

@@ -19,6 +19,13 @@ class Player:
   19    19         self.running = False
   20    20         self.weapon = '-'
   21    21 
   -1    22     def step(self):
   -1    23         if self.running:
   -1    24             if self.direction == RIGHT:
   -1    25                 self.x += 1
   -1    26             else:
   -1    27                 self.x -= 1
   -1    28 
   22    29     def _render(self):
   23    30         if self.running:
   24    31             if self.direction == LEFT:
@@ -92,6 +99,8 @@ class Game:
   92    99             while self.running:
   93   100                 last = time.time()
   94   101                 self.on_key(boon.getch())
   -1   102                 self.player1.step()
   -1   103                 self.player2.step()
   95   104                 self.render()
   96   105                 time.sleep(1 / 30 - (time.time() - last))
   97   106