-
Notifications
You must be signed in to change notification settings - Fork 2
Player Camera
In games, players may view the world through a specific way. Depending on the genre or style of the game, the 'view' can vary in perspective (first person vs third person), FOV and panning. This is what is also known as the 'camera'.
In Retroactive, players are subjected to an isometric third person camera that centres on their character. This is because a third person view can allow the player more visiblity of the room and their contents, as opposed to a restricting first person camera.
Step1: Change Entity player
from private to public under the class ForestGameArea
in order to make it can be accessed from non-child class.
public Entity player;
Step2: In the class ScreenAdapter
, create new properties entityPlayer
and PLAYER_POSITION
private Entity entityPlayer;
private Vector2 PLAYER_POSITION;
Step3: Make entityPlayer
to be player and set camera tracking player position
entityPlayer = forestGameArea.player;
PLAYER_POSITION = entityPlayer.getPosition();
renderer.getCamera().getEntity().setPosition(PLAYER_POSITION);
Step4: Overriding the method render
that set camera tracking player's position
PLAYER_POSITION = entityPlayer.getPosition();
renderer.getCamera().getEntity().setPosition(PLAYER_POSITION);
- Use the main camera as a sub-object of the Player.
- Fix the position and angle of the camera.
- Set the player's perspective as the main camera to keep the player in the centre of the screen.
Entities and Components
Interaction System
Unit Testing
Input Handling
UI
Game Screens and Areas
Map Generation
Basic Interactable Objects Design