Return to repo list

heart-of-gold

Tactical RPG written in python, using pygame.
Return to HMagellan.com

commit 315ef36927a204412e3c058dcf28a51f1d23d75a
parent 486b468d77e6aadf984d3074777bb0f942549128
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Tue, 17 Nov 2020 18:30:42 -0600

rudimentary facing calc on attack

Diffstat:
Msrc/piece.py | 14+++++++++++++-
Msrc/turn.py | 2--
2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/piece.py b/src/piece.py @@ -332,7 +332,19 @@ class Piece(entity.Entity): Setup and start an attack animation and the corresponding damage calculations. """ - # First, setup the animation + # Set facing + # TODO: Fails if range beyond 1, need to deal with relative vals in (x, y) + face_diff = (self.tile_pos[0] - target.tile_pos[0], self.tile_pos[1] - target.tile_pos[1]) + if face_diff == (1, 0): + self.facing = FACE_DIR.L + elif face_diff == (-1, 0): + self.facing = FACE_DIR.R + elif face_diff == (0, 1): + self.facing = FACE_DIR.U + elif face_diff == (0, -1): + self.facing = FACE_DIR.D + + # Setup the animation self.set_animation(self.manager.bus.fetch("sheet_manager", "animations")[self.sheet.name]["attack_" + self.facing.name], True) # Then, setup attack execution values diff --git a/src/turn.py b/src/turn.py @@ -33,8 +33,6 @@ class TurnManager(manager.Manager): self.turn_tick = 0 self.in_play_pieces = [] self.turn_depth = 10 - self.active_piece_has_moved = False - self.active_piece_has_acted = False # Turn tray and other associated entities self.turn_tray = None