Repository navigation
Player Actions
Krish edited this page Sep 3, 2026
·
2 revisions
Player actions deals with enacting the various actions of the player after an event is created for the relevant action. This involves changing the velocity of the player when movement occurs, enacting attacks, and implementing the dash feature.
-
DASH_SPEED_MULTIPLIERthe multiplier enacted on movement speed while the player is dashing. -
physicsComponentthe player's physics component/body -
combatStatsthe player's combat stats -
walkDirectionthe direction in which the player is walking, when the player is walking -
dashDirectionthe direction in which the player is dashing, when the player is dashing -
facingDirectionthe direction in which the player is facing. Relevant at all times -
movinga boolean value determining whether or not the player is currently moving. (i.e. the movement vector is not 0) -
animationthe current animation the player has running. ensures the player doesn't try to restart the already running animation -
dashInitthe time at which the dash action was most recently initiated -
dashOna boolean value determining whether or not the player is currently dashing -
dashCooldowna boolean value determining whether or not the dash is currently on cooldown (cooldown currently is turned off after 500 milliseconds) -
timethe GameTime object for accessing the game's time feature.
-
PlayerActions()used by PlayerFactory
-
create()retrieves all of the initial components this needs access too from the entity. Sets up all of the needed listeners within the entity for this class. -
update()updates the players speed given if the player is dashing, moving, etc. Checks if the players animation needs to be changed. -
updateSpeed()updates the velocity in the player's physicsComponent based on the directional speed vector obtained when the player moves. -
walk(Vector2 direction)updates the player's walking direction and facing direction if the player is not dashing. -
stopWalking()sets the player's current speed to 0 if the player is not dashing. -
attack()creates an attack event within the entity. Instantiates the attack sound. -
specialAttack()will create a special attack event within the entity once there is a relevant listener set up somewhere. Instantiates the special attack sound. -
dash(Vector2 direction)updates the player's dashing direction and records the time at which the dash was instantiated. Sets the dash to on.
-
update()may trigger a dashStop event if the dash finishes during the update. -
attack()creates a weaponAttack event.
Tested using Team 2 testing plan page