tighogg

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

commit
d90d4be24a7a51b884ed2b533f218c3c01810a82
parent
bf911f75576e15bdfbe0bc86d054e98ac3b7b03a
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2021-05-09 08:01
stop on walls

Diffstat

M tighogg.py 5 ++++-

1 files changed, 4 insertions, 1 deletions


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

@@ -73,15 +73,18 @@ class Player:
   73    73 
   74    74     def step(self):
   75    75         if self.running:
   -1    76             old_x = self.x
   76    77             if self.direction == RIGHT:
   77    78                 self.x += RUN_VELOCITY
   78    79             else:
   79    80                 self.x -= RUN_VELOCITY
   -1    81             if self.floor < self.y:
   -1    82                 self.x = old_x
   -1    83                 self.running = False
   80    84 
   81    85         if self.floor > self.y:
   82    86             self.dy += GRAVITY
   83    87         self.y += self.dy
   84    -1         # FIXME: auto climb
   85    88         if self.floor < self.y:
   86    89             self.dy = 0
   87    90             self.y = self.floor