summary refs log tree commit diff stats
path: root/src/direction.h
Commit message (Collapse)AuthorAgeFilesLines
* Improved eight-direction pathfindingStar Rauchenberger2021-07-061-0/+4
| | | | | | | | | | In the past, not using the "cardinal directions only" flag resulted in awkward and unintuitive paths. Two changes were made to the algorithm to improve these paths. One, nodes in the graph are now a pair of a position and the direction taken to get there. This way, a small penalty can be applied whenever a turn is taken, which should incentivise paths with fewer turns (which should be simpler). This change theoretically affects the cardinal mode as well, but in practice it is unlikely to change the paths that would've been generated. This also multiplies the search space by eight (four in cardinal mode), but so far it does not appear to be a significant resource drain. Two, the heuristic used in eight-directions mode is now octile distance, instead of dominant axis distance. Additionally, the real cost of moving diagonally is ~sqrt(2) instead of 1. This somewhat disincentivises diagonal movement, since it is no longer considered the same as cardinal movement (even though cardinal and diagonal movement occurs at the same speed), but the turning penalty makes moving diagonally more favourable than zigzagging cardinally to reach a diagonal destination. Most scripted movement in the game is likely to use cardinal mode because that mirrors the way most scripted movement in Mother 3 works, but in some cases (the Hinawa event on the cliff) diagonal movement just looks better, and thus it's useful to have the improved pathfinding algorithm.
* Added MirrorSystemKelly Rauchenberger2021-03-051-0/+13
| | | | 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.
* Fixed inverted Y coordinate of directionFacingPoint functionsKelly Rauchenberger2021-03-011-2/+2
| | | | It's because the game's coordinate system has Y increasing downward, whereas the coordinate system used by the trig functions has Y increasing upward.
* Started writing the Mixolydia scene!Kelly Rauchenberger2021-03-011-0/+17
| | | | | | Looking pretty good so far. TODO: direction facing functions have inverted Y coordinate. confusion expression doesn't exist yet. rest of scene.
* Added function to get Direction from one point to anotherKelly Rauchenberger2021-02-061-0/+26
|
* Added sprite interactionKelly Rauchenberger2021-02-061-0/+13
|
* Added collision with map tilesKelly Rauchenberger2021-02-021-0/+10
|
* Added crouching/runningKelly Rauchenberger2021-01-301-0/+14
|
* Added standing/walking animationsKelly Rauchenberger2021-01-301-0/+30