commit 992e3860c25482a0b65e23b97dfc78f1dc7cdf24
parent f632477175c6fdb3c5d251d758b43566a46853ee
Author: Erik Letson <hmagellan@hmagellan.com>
Date: Mon, 12 Oct 2020 22:24:16 -0500
Skeleton of Move classes
Diffstat:
A | src/move.py | | | 47 | +++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 47 insertions(+), 0 deletions(-)
diff --git a/src/move.py b/src/move.py
@@ -0,0 +1,47 @@
+import pygame
+from . import board
+from .constants import TILE_WIDTH, TILE_HEIGHT
+
+
+###########
+# move.py #
+###########
+
+# This file contains:
+# 1. The GenericMove class, which contains helper methods and values used by entities to move on the game board.
+# 2. The AIMove class, which inherits GenericMove and is used by entities with AI control to move.
+
+# NOTE: Player-controlled units just get the GenericMove class, since Interface or a Manager can use the methods
+# it contains to move such a unit.
+
+#####################################
+# Section 1 - The GenericMove class #
+#####################################
+
+class GenericMove(object):
+ """
+ GenericMove contains data, structures, values, and
+ methods that are used by Entities in a tile board to
+ move from tile to tile. An entity is created with a
+ 'move' value that is a GenericMove object or one of
+ its child objects.
+ """
+
+ def __init__(self, entity):
+
+ self.entity = entity
+
+################################
+# Section 2 - The AIMove class #
+################################
+
+class AIMove(GenericMove):
+ """
+ GenericMove class with additional functionality for
+ AI-controlled entities.
+ """
+
+ def __init__(self, entity):
+
+ # Parent initialization
+ super().__init__(entity)