A muliplatform entity-component system based 2D platformer powered by libGDX, Ashley ECS, and Tiled.
Currently using Ashley's Engine class. Will be migrating to PooledEngine in the near future, once the AnimationSystem has been implemented.
Entities do not have their own classes. They are added to the engine within the Level class.
Components are essentially just specialized data containers. To create a player, for instance, simply create an entity and add a CameraComponent, MovementComponent, TransformComponent, and TextureComponent.
Currently implemented:
- CameraComponent - Does not store a camera. Instead, tags an entity for focus from the GameScreen's Orthographic Camera.
- MovementComponent - Stores vectors for an entity's velocity and acceleration.
- TransformComponent - Stores vectors for an entity's position and scale and a value for the entity's angle of rotation.
- TextureComponent - Stores an entity's texture.
Systems handle the logic for each entity. An IteratingSystem is used to cycle through all entities to which the system applies. Mappers supply access to the components within the processEntity method. Systems are added to the engine in the GameScreen class, but can be added and removed as necessary within the Level class through the engine reference.
Currently implemented:
- CameraSystem - Controls the camera's position to the position of the entity.
- MovementSystem - Controls the entity's momentum over time by applying velocity and acceleration to the entity's position.
- PlayerInputSytem - Listens for key presses (and screen touches) to modify an entity's position and movement as necessary.
- RenderingSystem - Updates the GameScreen's SriteBatch by iterating through its entity renderQueue.
The Level class adds and removes entities (and systems) from the engine as needed and also loads the level's TiledMap and TiledMapRenderer.