Repository navigation
Render Components
Base rendering component for rendering an entity
- getDarkness(): gets current darkness level.
- getLightning(): gets current lightning timing.
- getBackgroundLight(): gets current bcakground darkness level.
- toggleWeather(): toggles weather, which will affect whether or not entities change their brightness when rendering.
- getWeather(): gets current weather status, true or false.
- updateDarkness(float deltaTime): Computes the current darkness level after a call to update.
- updateBackgroundLight(float deltaTime): Computes current background darkness level after a call to update.
Works the same as the general TextureRenderComponent, however has 3 new methods:
getTexture(): returns the current Texture object this render component is using setTexture(String texturePath): loads the asset located at the texture path provided and draws it on the next update frame setTexture(Texture texture): uses an already loaded Texture object directly and draws it on the next update frame
Furthermore, it also changes the batch draw to use a larger overload in order to respond to any rotation set on the entity. As such, for any map elements that utilise a RotatableMapComponent, at the very least, the DynamicTextureRenderComponent must be used to reflect the rotation request. See here for more information on RotatableMapComponent.java.
Extends the AnimationRenderComponent to utilise all the same functionality seen there, with a custom draw method that allows for a RotatableMapComponent's rotation request to be applied to any map element that requires a rotation AND has an animation texture atlas associated with it. There are no additional methods added here.
This component handles rendering of different background layers to produce a parallax background. It supports multiple parameters to design the background in a very large range of ways, allowing for very specifics effects to be added.
Variables:
- Texture texture: the texture of the layer
- Vector2 parallaxFactor: how much the layer moves relative to player movement, higher values cause it to move faster. A value of 1 will cause the layer to travel at -playerSpeed, while 0 will cause it to have no dependence on player movement.
- float width: the width of the layer
- float height: the height of the layer
- Vector2 offset: the positional offset of the layer relative to the position of the base background
- Vector2 velocity: the velocity of the layer independent to player movement
- Vector2 position: a position that is incremented relative to velocity, moving layers faster with higher velocities. Initially the start position of the layer.
- RepeatMode repeat: a RepeatMode value defined in GameArea which determines whether a layer should be repeated once travelling off the screen and what type of repeat mode it should use if so
- float distance: a float representing the 'distance' this layer is from the frame. It affects vertical movement of the layer following player movement. a distance of 1 will cause the background to not move vertically at all with player movement, and 0 to directly follow player vertical movement.
- float transparency: the transparency of the layer, also used to control the sense of how far away this layer visually appears.
- boolean flash: a boolean value to determine if this layer should only be visible during a lightning flash.
- int rotation: an integer from 0 to 360 determining how much the asset should rotate.
- int lightningOrder: an integer determining which order this layer should flash in, should only be used if flash is set to True, otherwise this value should be -1.
- parallaxLayer(texture, parallaxFactor, width, height, offset, velocity, repeat, distance, transparency): initiates a parallax layer
- backgroundRenderComponent(camera, backgroundPos, worldBounds): camera is the cameraComponent used in the gameArea, backgroundPos is the position of the base background, worldBounds are the worldBounds of the level.
- addLayer(texture, parallaxFactor, width, height, offset, velocity, repeat, distance, transparency): all parameters same as above except texture is passed as a String not a Texture
- getLayerCount(): returns the number of layers this component currently has.
- scaleEntity(Vector2 factor, Vector2 worldBounds, boolean up, String level): Scales background layers up or down for a specific level to display a level map.
- getPosUpdate(ParallaxLayer layer): updates the position of the layer based on velocity of the layer, and applies lightning layer visibility
- getPosition(ParallaxLayer layer, Vector3 cameraPos, Vector2 position): returns the position for a single layer based off its parameters and current position.
- draw(SpriteBatch batch): draws each layer with computed layer positions
Entities and Components
Input Handling
Arrow Selection Wheel Arrow Selection Wheel — Sprint 3