diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-27 17:40:26 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-27 17:40:26 -0500 |
commit | e03683852cac9b31ca846fcf13ff53abf99232c7 (patch) | |
tree | 4f18e4f6d033547f8bf9210ff8466406ed6dbd49 /src/sprite.h | |
parent | 4be70b7d55493cdc2d5e909d5101e70a16bee6f1 (diff) | |
download | tanetane-e03683852cac9b31ca846fcf13ff53abf99232c7.tar.gz tanetane-e03683852cac9b31ca846fcf13ff53abf99232c7.tar.bz2 tanetane-e03683852cac9b31ca846fcf13ff53abf99232c7.zip |
Added A* pathfinding
Diffstat (limited to 'src/sprite.h')
-rw-r--r-- | src/sprite.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/sprite.h b/src/sprite.h index 733c792..13d0383 100644 --- a/src/sprite.h +++ b/src/sprite.h | |||
@@ -40,12 +40,23 @@ enum class CharacterMedium { | |||
40 | Water | 40 | Water |
41 | }; | 41 | }; |
42 | 42 | ||
43 | enum class BehaviourType { | ||
44 | None, | ||
45 | Wander, | ||
46 | Path | ||
47 | }; | ||
48 | |||
43 | struct Movement { | 49 | struct Movement { |
44 | vec2i pos; | 50 | vec2i pos; |
45 | Direction dir; | 51 | Direction dir; |
46 | CharacterMedium medium; | 52 | CharacterMedium medium; |
47 | }; | 53 | }; |
48 | 54 | ||
55 | struct PathfindingInstruction { | ||
56 | Direction dir; | ||
57 | vec2i endpoint; | ||
58 | }; | ||
59 | |||
49 | class Sprite { | 60 | class Sprite { |
50 | public: | 61 | public: |
51 | 62 | ||
@@ -106,7 +117,10 @@ public: | |||
106 | bool player = false; | 117 | bool player = false; |
107 | 118 | ||
108 | // Behaviour | 119 | // Behaviour |
109 | bool wander = false; | 120 | BehaviourType behaviourType = BehaviourType::None; |
121 | vec2i pathfindingDestination; | ||
122 | bool cardinalDirectionsOnly = false; | ||
123 | std::deque<PathfindingInstruction> path; | ||
110 | }; | 124 | }; |
111 | 125 | ||
112 | #endif /* end of include guard: SPRITE_H_70503825 */ | 126 | #endif /* end of include guard: SPRITE_H_70503825 */ |