summary refs log tree commit diff stats
path: root/src/systems/pondering.h
Commit message (Collapse)AuthorAgeFilesLines
* Fixed ferries pushing passengersKelly Rauchenberger2018-05-091-2/+1
| | | | | | Ferries now pretend that their passengers have already moved by the appropriate delta when detecting collision in the direction of their passengers. This allows a ferry to move into the space where their passengers are when there is nothing else blocking it. It also allows for special behavior when a passenger is crushed between its ferry and a wall, but this is not yet implemented. This fixes the first issue described in 8f1c4f1 -- that ferries cannot push their passengers. With this fix, ferries are basically functional.
* Simplified positions/sizes with vectorsKelly Rauchenberger2018-05-091-18/+16
| | | | Positions and sizes are now stored as vectors (of doubles and ints, respectively). This allows for at least minor code simplification in many places, and cleans up the CollisionParams code in PonderingSystem quite a bit.
* Started refactoring collision detection to use directional functorKelly Rauchenberger2018-05-091-11/+29
| | | | Because there was a lot of code replication with collision detection, this new implementation uses a functor that takes a parameter object describing the things that are different between the four directions. This allows the collision detection code to be writen only once. It's currently very ugly, but should work identically to before.
* Recursively handle ferried bodiesKelly Rauchenberger2018-05-091-0/+5
| | | | PonderingSystem now recursively ticks bodies, starting with unferried bodies at the top level, and recursively ticking their passengers. This fixes the second issue described in 8f1c4f1 -- that passengers may be ticked before their ferries, causing it to use out-of-date information about the ferry's location.
* Unferried players while changing mapsKelly Rauchenberger2018-05-091-0/+14
| | | | This fixes the third problem described in 8f1c4f1 -- that if a ferried body's transform is modified outside of the PonderingSystem, it will not be unferried as appropriate. This does still require that any future code that modifies a body's transform also unferries the body first.
* Added ferrying (buggy)Kelly Rauchenberger2018-05-091-0/+1
| | | | | | | | | | | | A freefalling body is considered to be "ferried" if it is grounded by another body (not a map). Its location is then dependent on the ferry's location; in this way, the ferry carries the passenger around. This implementation is kind of buggy currently: first of all, ferrying does not work vertically upward, because the ferry will consider the passenger to be a wall and will not continue moving upward. Second, ferries are not processed before passengers, so passengers can move in a physics tick using the knowledge of a ferry's location before it moves in that tick. Third, if the transform coordinates are set by any system other than the PonderingSystem, the relative coordinates to the ferry will not be updated and the body will not be unferried if necessary. This is still a cool commit because, three years later, we have finally overcome the issue that stopped development on the original branch in 2015.
* Added map object collisionKelly Rauchenberger2018-04-291-0/+23
| | | | | | | | | | | | Collision checking in PonderingSystem was rewritten to work as follows: horizontal movement is step first, then vertical. In each step, the closest environmental boundary to the body is found on the axis of movement in the space traversed by the body. Then, if any map objects fall in the region between the body's old position and the environmental boundary (or body new position if no boundary was found), process collision with those bodies in increasing distance order, stopping if a collision stops movement short of where the next collision would take place. After this, process collision with all of the environmental boundaries at the axis distance found earlier, as long as movement hasn't stopped short. This is not the most optimal implementation, and there is a lot of code repetition, but it is a start and it works. All map objects currently function as walls. This fixes the bug where you could, with pixel-perfect precision, jump into the corner of a wall tile. The top of the hitbox for the spike tile was lowered by one pixel. This fixes a problem where if the player is halfway on a floor tile and halfway over a spike tile, the floor tile would not stop the spike tile from being processed, and the player would die.
* Restructured the way the world is loadedKelly Rauchenberger2018-04-281-0/+2
| | | | | | | | | | The World class was removed and replaced by the RealizingSystem and RealizableComponent. The realizable entity is intended to be a singleton and to represent the world. The Map class was also removed and integrated into the MappableComponent. These changes are to facilitate implementation of map objects without needing special intermediary objects (including the Map class). Now, map entities are created as soon as the world is created, and map object entities will be as well. They will simply be deactivated while the map is not active. Multiple players are now slightly better supported, which will be important in the future. This will likely become inefficient as the world becomes bigger, and some sort of sector-loading process will have to be designed. This also reduces the usefulness of EntityManager's entity-searching capabilities (which are not the most efficiently implemented currently anyway), and will likely in the future require some added functionality to better search subsets of entities. A lot of the components were also rewritten to use bare member variables instead of accessor methods, as they never had special functionality and just took up space. These components were also documented.
* Implemented map adjacencyKelly Rauchenberger2018-02-181-11/+0
| | | | | | This brings along with it the ability to move to different maps, for which the PlayingSystem and PlayableComponent were introduced. The PlayingSystem is a general overseer system that handles big picture stuff like initializing the player and changing maps. The PlayableComponent represents the player. While the ControllableComponent is also likely to always only be on the player entity, the two are distinct by separation of concerns. This also required a refactoring of how collisions are processed, because of a bug where the player can move to a new map when horizontal collisions are checked, and vertical collisions are skipped, causing the player to clip through the ground because the normal force was never handled.
* Implemented map rendering and basic collisionKelly Rauchenberger2018-02-111-0/+16
| | | | Only wall and platform collision currently works, and map edges are not currently implemented.
* Introduced animated spritesKelly Rauchenberger2018-02-081-4/+6
| | | | Also restyled a lot of the code.
* Whitespace changesKelly Rauchenberger2018-02-051-1/+1
|
* Player now movesKelly Rauchenberger2015-06-261-0/+14