-
Notifications
You must be signed in to change notification settings - Fork 0
Player Rolling Functionality
While landed, the player can hit Q or E to roll left or right, respectively.
The roll functionality makes use of the RollComponent class, and works closely with the KeyboardPlayerInputComponent and PlayerActions classes.
The main variables which control the characteristics of the roll mechanism is the RollComponents ROLL_LENGTH, ROLL_TIME and ROLL_COOL_DOWN.
-
ROLL_LENGTH: the 'length' of the players roll. Increasing this variable increases the players speed throughout the roll. -
ROLL_TIME: the duration of the players roll. Increasing this variable increases how long the player will move for. -
ROLL_COOL_DOWN: the cool-down that the player must wait for before they are able to roll again. Increasing this variable increases the amount of time the player must wait between rolls.
Currently, rolling does not drain Sprint nor any sort of Stamina.
When the player hits Q or E, if the player is not mid-air, the RollComponent's handleRolling function is called.
public void handleRolling(Vector2 direction) {
/* Rudimentary set-up code */
...
move(direction.cpy().scl(ROLL_LENGTH));
animateRoll();
}The move function calls upon the PlayerActions walk function.
After the addition of dynamic map generation as part of the new terrain, it was found that using offCollision as a mechanism to determine whether or not the player fell off an object was not suitable. The previous implementation was amended to automatically (always) reapply gravity to the player as soon as the roll ends, regardless of whether they fell off something or not. The new handleStopRolling function is as follows:
private void handleStopRolling() {
/* Rudimentary set-down code */
...
stopRollAnimation();
entity.getEvents().trigger("walk", Vector2Utils.DOWN);
...
}After the ROLL_TIME has elapsed, the RollComponents handleStopRolling function is called.
private void handleStopRolling() {
/* Rudimentary set-down code */
...
handleCheckingFallRequired();
}Additional actions must be taken if the player rolled off something. Since the roll has a set duration, there is no keyUp functionality for it (ie, nothing happens when the player releases the Q or E key, dissimilar to A and D in the walk functionality). Due to this, the player must manually have gravity re-applied to bring them back to the ground.
private void handleCheckingFallRequired() {
if (the player rolled off something) {
this.falling = true;
move(Vector2Utils.Down);
}
}Whether or not the player rolled off something is determined using offCollisions. If the player stopped colliding with something while they were rolling, then they have fallen off of a physics object.
Once the player reaches the ground, they are able to roll again once the cool-down period ends.
After the player has rolled, the lastRollEnded variable is set, which is a double containing the absolute time at which the players roll will end. Once this time is hit, the rollOnCoolDown variable is set to false, and the player will be able to roll again.
- Player UI
- Popup Menus
- Obstacles
- Boss Enemies
- Progress Tracker
- Checkpoint Design and Functionality
- Score System
- Lives System
- Game Background
- Multiple game-level
- Visual Improvements
- Tutorial Level
- Character Design and Animations
- Character Damage Animations
- Player Animation Functionalities
- Player and Serpent Portal Transition
- Pop-up Menus
- Obstacles
- Lives & Score User Testing
- Buffs & Debuffs
- Buffs & Debuffs redesign
- Obstacle Animation
- Background Design
- Level 2 Background Appearance
- Enemy Monster User Testing
- Level 1 Floor Terrain Testing
- Introduction Screens User Testing
- Character Movement Interviews & User Testing
- Sound user testing
- Level 2 Obstacles and enemy
- Story, Loading, Level 4 and Win Condition Sound Design User Testing
- Giant Bug and Purple Squid animation user testing
- General Gameplay and Tutorial Level User Testing
- Level 4 Terrain User Testing
- Game Outro User Testing