-
Notifications
You must be signed in to change notification settings - Fork 3
Player Input and Controls
When the player has pressed the correct controls, the entities will trigger an event depending on the control passed in. The set of controls currently available are W, A, S, D for basic player movement, LEFT_SHIFT for sprint and CAPS_LOCK for dashing (to be changed).
Pressing any of these keys will cause an event to be triggered, W, A, S, D will trigger a walk event, LEFT_SHIFT will update the speed multiplier and CAPS_LOCK triggers the dash event.
This class handles what inputs do for anything related to the character. Each event needs to be added to the EventListener list and some of the methods included in this class are:
-
walk
: sets the direction the player is walking in and sets moving to true -
stopWalking
: sets the direction the player is walking in to zero and sets moving to false -
attack
: currently plays a sound but this is to be changed -
dash
: sets the direction the player is walking in and sets moving to true
This class handles the keyboard inputs from the player. It will check for key presses and releases and will call methods accordingly. The keys that are currently being checked for are:
-
W
: moves the character up -
A
: moves the character left -
S
: moves the character down -
D
: moves the character right -
LEFT_SHIFT
: changes the speed multiplier -
CAPS_LOCK
: the character dashes in the direction currently being moved in -
MOUSE_1
orSPACE
: calls an attack * - *If
MOUSE_1
the direction of the attack is dependant on the quadrant that the mouse is clicked in. IfSPACE
the direction of the attack is dependant on the direction that the player last moved.
Private Methods:
-
triggerWalkEvent
: calculates the vector distances the player is to move in and then triggers the walk event -
triggerDashEvent
: calculates the vector distances the player is to dash in and then triggers the dash event -
calculateDistance
: calculates the vector distances depending on diagonal movement and scale
The base game engine did not have anything to handle diagonal movement so a private helper method calculateDistance
has been made to check if the player is moving diagonally as well as multiply the vectors by a scale that has been passed in.
More abilities are to be added such as basic attacking and other damaging abilities. These abilities would need a cost or a cooldown for usage. Attacks may require mouse input which will be handled by a different class depending on how the character will be controlled.
Using CAPS_LOCK and SHIFT can feel awkward to switch between so testing of a mechanic that causes the player to only sprint after a dash will be trialed and tested to determine if it makes the controls feel more coherent.
At times the dashing ability can feel jerky and does the frames cannot keep up with it. Changing the dash so the speed will gradually scale to max speed has been considered and will be tested to see if this will help.
The association between the PlayerActions, PlayerAnimations and the Player class is abstracted with the used of a physics class for movement and an animator class for animation.
KeyboardPlayerInput, PlayerActions and PlayerAnimations are all components that the entity contains. The KeyboardPlayerInput will trigger events that will call methods within PlayerActions and PlayerAnimations.
Design Document
- Story
- Music
-
Characters
- Main Character
- Bosses
-
Enemies
- Sprint 1: Final Design
-
Sprint 2: Elvish Boss
- Decision to make our boss a mage
- Design Inspiration: Staff Weapon
- Design decisions for boss
- Archery attack animation for minions
- Different types of minion elves and designs
- Melee attack animation
- Boss attack animation using sceptre
- Design Inspiration: Shooting fireballs
- Mage Boss attack method: fireball
- Sprint 3: Walk Animations and Design Amendments
- Sprint 4: Refining animations
- Map Design
- User + Play Testing
- Gameplay
- Art Style Design Guidelines
- Emotional Goals