From 1c462ef3780b33468ed93dde3ab6178765807ffe Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 5 Mar 2021 20:50:51 -0500 Subject: Added MirrorSystem This is really just for letting one sprite mirror another's movement and animation. I tried doing it in the BehaviourSystem, but you get stuttering if you do it earlier in the loop than the CharacterSystem, so I ended up having to make a new system just for this thing that will not happen very often. --- src/direction.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/direction.h') diff --git a/src/direction.h b/src/direction.h index 432f7a9..325bcaf 100644 --- a/src/direction.h +++ b/src/direction.h @@ -65,6 +65,19 @@ inline Direction oppositeDirection(Direction value) { } } +inline Direction directionMirroredVertically(Direction value) { + switch (value) { + case Direction::up: return Direction::down; + case Direction::up_right: return Direction::down_right; + case Direction::right: return Direction::right; + case Direction::down_right: return Direction::up_right; + case Direction::down: return Direction::up; + case Direction::down_left: return Direction::up_left; + case Direction::left: return Direction::left; + case Direction::up_left: return Direction::down_left; + } +} + inline Direction directionFacingPoint(vec2i point) { double theta = atan2(-point.y(), point.x()); theta /= M_PI; -- cgit 1.4.1